summaryrefslogtreecommitdiff
path: root/lisp/gnus/mailcap.el
diff options
context:
space:
mode:
authorLars Magne Ingebrigtsen <larsi@gnus.org>2014-12-05 16:40:45 +0100
committerLars Magne Ingebrigtsen <larsi@gnus.org>2014-12-05 16:51:59 +0100
commit7747e23ecd6c7b140a67812ad22421ef426a7a24 (patch)
tree3b865a9ddc3cb6af2a4e412bfb8158f02f9de0b5 /lisp/gnus/mailcap.el
parentd2fab6bf584b967940e7f0a6d6a457933cc4a972 (diff)
downloademacs-7747e23ecd6c7b140a67812ad22421ef426a7a24.tar.gz
emacs-7747e23ecd6c7b140a67812ad22421ef426a7a24.tar.bz2
emacs-7747e23ecd6c7b140a67812ad22421ef426a7a24.zip
Make it easier to use mailcap for viewing single files
* mailcap.el (mailcap-mime-data): Add doc-view-mode as a viewer for PDFs. (mailcap-view-mime): New function.
Diffstat (limited to 'lisp/gnus/mailcap.el')
-rw-r--r--lisp/gnus/mailcap.el16
1 files changed, 16 insertions, 0 deletions
diff --git a/lisp/gnus/mailcap.el b/lisp/gnus/mailcap.el
index 4f1bdf4b1df..1a1a9923425 100644
--- a/lisp/gnus/mailcap.el
+++ b/lisp/gnus/mailcap.el
@@ -153,6 +153,10 @@ This is a compatibility function for different Emacsen."
(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")
(test . window-system)
@@ -1060,6 +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)
;;; mailcap.el ends here