lisp/gnus/mm-decode.el (mm-display-external): Work for xdg-open
authorKatsumi Yamaoka <yamaoka@jpl.org>
Tue, 6 Aug 2013 13:52:59 +0000 (13:52 +0000)
committerKatsumi Yamaoka <yamaoka@jpl.org>
Tue, 6 Aug 2013 13:52:59 +0000 (13:52 +0000)
lisp/gnus/ChangeLog
lisp/gnus/mm-decode.el

index 2ae7079..238017e 100644 (file)
@@ -1,3 +1,10 @@
+2013-08-06  Katsumi Yamaoka  <yamaoka@jpl.org>
+
+       * mm-decode.el (mm-display-external): Bind process-connection-type to
+       nil; don't delete a temp file immediately even if a viewer finishes,
+       since it may be a shell script, like xdg-open, that launches a real
+       viewer program belatedly.
+
 2013-08-05  Dave Abrahams  <dave@boostpro.com>
 
        * gnus-int.el (gnus-warp-to-article): Allow warping in all groups so
index 7274708..98d8543 100644 (file)
@@ -962,7 +962,7 @@ external if displayed external."
            (let ((command (mm-mailcap-command
                            method file (mm-handle-type handle))))
              (unwind-protect
-                 (progn
+                 (let ((process-connection-type nil))
                    (start-process "*display*"
                                   (setq buffer
                                         (generate-new-buffer " *mm*"))
@@ -984,12 +984,13 @@ external if displayed external."
                            (delete-directory (file-name-directory file)))))
                       (lambda (process state)
                         (when (eq (process-status process) 'exit)
-                          (condition-case nil
-                              (delete-file file)
-                            (error))
-                          (condition-case nil
-                              (delete-directory (file-name-directory file))
-                            (error))
+                          (run-at-time
+                           10.0 nil
+                           (lambda ()
+                             (ignore-errors
+                               (delete-file file))
+                             (ignore-errors
+                               (delete-directory (file-name-directory file)))))
                           (when (buffer-live-p outbuf)
                             (with-current-buffer outbuf
                               (let ((buffer-read-only nil)