X-Git-Url: http://cgit.sxemacs.org/?p=gnus;a=blobdiff_plain;f=lisp%2Fmailcap.el;h=01d8587f06a66e1b579b12f92586d24bb9d443fc;hp=5580bc7d6682b79f31b7da22f7c206ef48168794;hb=b83561e18ceb438203812786590893bd5fc2a6cc;hpb=e2c9efb05a1ae9e65fd40bab80466da331f3981b diff --git a/lisp/mailcap.el b/lisp/mailcap.el index 5580bc7d6..01d8587f0 100644 --- a/lisp/mailcap.el +++ b/lisp/mailcap.el @@ -1,7 +1,6 @@ ;;; mailcap.el --- MIME media types configuration -;; Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, -;; 2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc. +;; Copyright (C) 1998-2015 Free Software Foundation, Inc. ;; Author: William M. Perry ;; Lars Magne Ingebrigtsen @@ -83,7 +82,7 @@ This is a compatibility function for different Emacsen." (list lpr-switches) lpr-switches))) " ") - "Shell command (including switches) used to print Postscript files.") + "Shell command (including switches) used to print PostScript files.") ;; Postpone using defcustom for this as it's so big and we essentially ;; have to have two copies of the data around then. Perhaps just @@ -91,7 +90,7 @@ This is a compatibility function for different Emacsen." ;; files for the rest? -- fx (defvar mailcap-mime-data `(("application" - ("vnd.ms-excel" + ("vnd\\.ms-excel" (viewer . "gnumeric %s") (test . (getenv "DISPLAY")) (type . "application/vnd.ms-excel")) @@ -153,6 +152,10 @@ This is a compatibility function for different Emacsen." (non-viewer . t) (type . "application/zip") ("copiousoutput")) + ("pdf" + (viewer . doc-view-mode) + (type . "application/pdf") + (test . (eq window-system 'x))) ("pdf" (viewer . "gv -safer %s") (type . "application/pdf") @@ -216,10 +219,6 @@ This is a compatibility function for different Emacsen." (viewer . vm-mode) (test . (fboundp 'vm-mode)) (type . "message/rfc822")) - ("rfc-*822" - (viewer . w3-mode) - (test . (fboundp 'w3-mode)) - (type . "message/rfc822")) ("rfc-*822" (viewer . view-mode) (type . "message/rfc822"))) @@ -253,10 +252,6 @@ This is a compatibility function for different Emacsen." (test . (eq window-system 'x)) ("needsx11"))) ("text" - ("plain" - (viewer . w3-mode) - (test . (fboundp 'w3-mode)) - (type . "text/plain")) ("plain" (viewer . view-mode) (test . (fboundp 'view-mode)) @@ -268,10 +263,6 @@ This is a compatibility function for different Emacsen." (viewer . enriched-decode) (test . (fboundp 'enriched-decode)) (type . "text/enriched")) - ("html" - (viewer . mm-w3-prepare-buffer) - (test . (fboundp 'w3-prepare-buffer)) - (type . "text/html")) ("dns" (viewer . dns-mode) (test . (fboundp 'dns-mode)) @@ -335,7 +326,7 @@ nil means your home directory." :group 'mailcap) (defvar mailcap-poor-system-types - '(ms-dos ms-windows windows-nt win32 w32 mswindows) + '(ms-dos windows-nt) "Systems that don't have a Unix-like directory hierarchy.") ;;; @@ -423,7 +414,7 @@ MAILCAPS if set; otherwise (on Unix) use the path from RFC 1524, plus "/usr/local/etc/mailcap")))) (let ((fnames (reverse (if (stringp path) - (delete "" (split-string path path-separator)) + (split-string path path-separator t) path))) fname) (while fnames @@ -812,7 +803,10 @@ If NO-DECODE is non-nil, don't decode STRING." ;;; (defvar mailcap-mime-extensions - '(("" . "text/plain") + '(("" . "text/plain") + (".1" . "text/plain") ;; Manual pages + (".3" . "text/plain") + (".8" . "text/plain") (".abs" . "audio/x-mpeg") (".aif" . "audio/aiff") (".aifc" . "audio/aiff") @@ -828,6 +822,7 @@ If NO-DECODE is non-nil, don't decode STRING." (".css" . "text/css") (".dvi" . "application/x-dvi") (".diff" . "text/x-patch") + (".dpatch". "test/x-patch") (".el" . "application/emacs-lisp") (".eps" . "application/postscript") (".etx" . "text/x-setext") @@ -869,6 +864,7 @@ If NO-DECODE is non-nil, don't decode STRING." (".pict" . "image/pict") (".png" . "image/png") (".pnm" . "image/x-portable-anymap") + (".pod" . "text/plain") (".ppm" . "image/portable-pixmap") (".ps" . "application/postscript") (".qt" . "video/quicktime") @@ -905,7 +901,8 @@ If NO-DECODE is non-nil, don't decode STRING." (".zip" . "application/zip") (".ai" . "application/postscript") (".jpe" . "image/jpeg") - (".jpeg" . "image/jpeg")) + (".jpeg" . "image/jpeg") + (".org" . "text/x-org")) "An alist of file extensions and corresponding MIME content-types. This exists for you to customize the information in Lisp. It is merged with values from mailcap files by `mailcap-parse-mimetypes'.") @@ -941,7 +938,7 @@ If FORCE, re-parse even if already parsed." "/usr/local/etc/mime-types" "/usr/local/www/conf/mime-types")))) (let ((fnames (reverse (if (stringp path) - (delete "" (split-string path path-separator)) + (split-string path path-separator t) path))) fname) (while fnames @@ -1067,7 +1064,18 @@ If FORCE, re-parse even if already parsed." common-mime-info))))) commands)) +(defun mailcap-view-mime (type) + "View the data in the current buffer that has MIME type TYPE. +`mailcap-mime-data' determines the method to use." + (let ((method (mailcap-mime-info type))) + (if (stringp method) + (shell-command-on-region (point-min) (point-max) + ;; Use stdin as the "%s". + (format method "-") + (current-buffer) + t) + (funcall method)))) + (provide 'mailcap) -;; arch-tag: 1fd4f9c9-c305-4d2e-9747-3a4d45baa0bd ;;; mailcap.el ends here