X-Git-Url: http://cgit.sxemacs.org/?p=gnus;a=blobdiff_plain;f=lisp%2Fmailcap.el;h=d8881104af8acb07c5739a91965361eca80b52bb;hp=524928586fc29846b01a6be17c7e1515fcd9ae41;hb=d20dda5b1d899018825f1f3e7099f22455d83afe;hpb=60f3bccd1b6416278750cb85362503b8fcd55df9 diff --git a/lisp/mailcap.el b/lisp/mailcap.el index 524928586..d8881104a 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, 2010 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,16 @@ This is a compatibility function for different Emacsen." (non-viewer . t) (type . "application/zip") ("copiousoutput")) + ("pdf" + (viewer . pdf-view-mode) + (type . "application/pdf") + (test . (and (fboundp 'pdf-view-mode) + (eq window-system 'x)))) + ("pdf" + (viewer . doc-view-mode) + (type . "application/pdf") + (test . (and (fboundp 'doc-view-mode) + (eq window-system 'x)))) ("pdf" (viewer . "gv -safer %s") (type . "application/pdf") @@ -216,10 +225,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 +258,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 +269,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)) @@ -559,8 +556,11 @@ MAILCAPS if set; otherwise (on Unix) use the path from RFC 1524, plus results))) (defun mailcap-mailcap-entry-passes-test (info) - "Return non-nil if mailcap entry INFO passes its test clause. -Also return non-nil if no test clause is present." + "Replace the test clause of INFO itself with a boolean for some cases. +This function supports only `test -n $DISPLAY' and `test -z $DISPLAY', +replaces them with t or nil. As for others or if INFO has a interactive +spec (needsterm, needsterminal, or needsx11) but DISPLAY is not set, +the test clause will be unchanged." (let ((test (assq 'test info)) ; The test clause status) (setq status (and test (split-string (cdr test) " "))) @@ -812,7 +812,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 +831,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 +873,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 +910,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'.") @@ -1067,6 +1073,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) ;;; mailcap.el ends here