Do not overwrite preexisting contents of unread-command-events
[gnus] / lisp / mailcap.el
index dffb279..9f84413 100644 (file)
@@ -1,6 +1,6 @@
 ;;; mailcap.el --- MIME media types configuration
 
-;; Copyright (C) 1998-2011 Free Software Foundation, Inc.
+;; Copyright (C) 1998-2015 Free Software Foundation, Inc.
 
 ;; Author: William M. Perry <wmperry@aventail.com>
 ;;     Lars Magne Ingebrigtsen <larsi@gnus.org>
@@ -82,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
@@ -90,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"))
@@ -152,6 +152,15 @@ 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 . (eq window-system 'x)))
      ("pdf"
       (viewer . "gv -safer %s")
       (type . "application/pdf")
@@ -215,10 +224,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")))
@@ -252,10 +257,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))
@@ -267,10 +268,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))
@@ -1072,6 +1069,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