emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master a34a80a: Fix viewing PDFs from eww with external viewers


From: Lars Ingebrigtsen
Subject: master a34a80a: Fix viewing PDFs from eww with external viewers
Date: Fri, 11 Sep 2020 08:06:13 -0400 (EDT)

branch: master
commit a34a80a878f37832cc5e59f2c26ea1779eca5cf8
Author: Lars Ingebrigtsen <larsi@gnus.org>
Commit: Lars Ingebrigtsen <larsi@gnus.org>

    Fix viewing PDFs from eww with external viewers
    
    * lisp/net/mailcap.el (mailcap-view-mime): Most MIME viewers can't
    take input on stdin (and in any case, "-" is not how many of them
    designate stdin) (bug#43318).  So rewrite to put the data on a
    file and feed the file name to the viewer.
---
 lisp/net/mailcap.el | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/lisp/net/mailcap.el b/lisp/net/mailcap.el
index f01a5de..e84fe5f 100644
--- a/lisp/net/mailcap.el
+++ b/lisp/net/mailcap.el
@@ -1133,11 +1133,14 @@ For instance, \"foo.png\" will result in \"image/png\"."
 `mailcap--computed-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)
+        (let ((file (make-temp-file "emacs-mailcap" nil
+                                    (cadr (split-string type "/")))))
+          (unwind-protect
+              (let ((coding-system-for-write 'binary))
+                (write-region (point-min) (point-max) file nil 'silent)
+                (shell-command (format method file)))
+            (when (file-exists-p file)
+              (delete-file file))))
       (funcall method))))
 
 (provide 'mailcap)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]