+2005-07-27 Katsumi Yamaoka <yamaoka@jpl.org>
+
+ * mm-decode.el (mm-display-external): Delete temp file, directory
+ and buffer immediately if the external process is exited.
+
2005-07-26 Katsumi Yamaoka <yamaoka@jpl.org>
* gnus-art.el (gnus-article-next-page-1): Don't scroll if there're
(let ((command (mm-mailcap-command
method file (mm-handle-type handle))))
(unwind-protect
- (start-process "*display*"
- (setq buffer
- (generate-new-buffer " *mm*"))
- shell-file-name
- shell-command-switch command)
+ (progn
+ (start-process "*display*"
+ (setq buffer
+ (generate-new-buffer " *mm*"))
+ shell-file-name
+ shell-command-switch command)
+ (set-process-sentinel
+ (get-buffer-process buffer)
+ `(lambda (process state)
+ (when (eq 'exit (process-status process))
+ ;; Don't use `ignore-errors'.
+ (condition-case nil
+ (delete-file ,file)
+ (error))
+ (condition-case nil
+ (delete-directory ,(file-name-directory file))
+ (error))
+ (condition-case nil
+ (kill-buffer ,buffer)
+ (error))
+ (condition-case nil
+ ,(macroexpand (list 'mm-handle-set-undisplayer
+ (list 'quote handle)
+ nil))
+ (error))
+ (message "Displaying %s...done" ,command)))))
(mm-handle-set-external-undisplayer
handle (cons file buffer)))
(message "Displaying %s..." command))