diff options
| author | Katsumi Yamaoka | 2013-08-12 05:59:47 +0000 |
|---|---|---|
| committer | Katsumi Yamaoka | 2013-08-12 05:59:47 +0000 |
| commit | 7cfa5cecf7c4102ca514ae3a61a1815d40961d00 (patch) | |
| tree | 353bb841554bfa15be1730cdf9f7ccb7d8b3f274 | |
| parent | d401ef43f694e9d0a53427475ef4887606e1ccdb (diff) | |
| download | emacs-7cfa5cecf7c4102ca514ae3a61a1815d40961d00.tar.gz emacs-7cfa5cecf7c4102ca514ae3a61a1815d40961d00.zip | |
lisp/gnus/mm-decode.el (mm-display-external): Run a timer for the temp files deletion after a viwer exits; add a deletion timer for the needsterm case, too
| -rw-r--r-- | lisp/gnus/ChangeLog | 4 | ||||
| -rw-r--r-- | lisp/gnus/mm-decode.el | 43 |
2 files changed, 32 insertions, 15 deletions
diff --git a/lisp/gnus/ChangeLog b/lisp/gnus/ChangeLog index 6b7be997ea9..1d8c6e4a732 100644 --- a/lisp/gnus/ChangeLog +++ b/lisp/gnus/ChangeLog | |||
| @@ -1,5 +1,9 @@ | |||
| 1 | 2013-08-12 Katsumi Yamaoka <yamaoka@jpl.org> | 1 | 2013-08-12 Katsumi Yamaoka <yamaoka@jpl.org> |
| 2 | 2 | ||
| 3 | * mm-decode.el (mm-display-external): Run a timer for the temp files | ||
| 4 | deletion after a viwer exits; add a deletion timer for the needsterm | ||
| 5 | case, too. | ||
| 6 | |||
| 3 | * mm-decode.el (mm-display-external): Try to delete temporary files by | 7 | * mm-decode.el (mm-display-external): Try to delete temporary files by |
| 4 | using a 1-min. timer. | 8 | using a 1-min. timer. |
| 5 | 9 | ||
diff --git a/lisp/gnus/mm-decode.el b/lisp/gnus/mm-decode.el index 40c1d849f3c..dbbf0befe60 100644 --- a/lisp/gnus/mm-decode.el +++ b/lisp/gnus/mm-decode.el | |||
| @@ -954,10 +954,20 @@ external if displayed external." | |||
| 954 | method file (mm-handle-type handle)))) | 954 | method file (mm-handle-type handle)))) |
| 955 | (unwind-protect | 955 | (unwind-protect |
| 956 | (if window-system | 956 | (if window-system |
| 957 | (start-process "*display*" nil | 957 | (set-process-sentinel |
| 958 | mm-external-terminal-program | 958 | (start-process "*display*" nil |
| 959 | "-e" shell-file-name | 959 | mm-external-terminal-program |
| 960 | shell-command-switch command) | 960 | "-e" shell-file-name |
| 961 | shell-command-switch command) | ||
| 962 | `(lambda (process state) | ||
| 963 | (if (eq 'exit (process-status process)) | ||
| 964 | (run-at-time | ||
| 965 | 60.0 nil | ||
| 966 | (lambda () | ||
| 967 | (ignore-errors (delete-file ,file)) | ||
| 968 | (ignore-errors (delete-directory | ||
| 969 | ,(file-name-directory | ||
| 970 | file)))))))) | ||
| 961 | (require 'term) | 971 | (require 'term) |
| 962 | (require 'gnus-win) | 972 | (require 'gnus-win) |
| 963 | (set-buffer | 973 | (set-buffer |
| @@ -971,11 +981,15 @@ external if displayed external." | |||
| 971 | (set-process-sentinel | 981 | (set-process-sentinel |
| 972 | (get-buffer-process buffer) | 982 | (get-buffer-process buffer) |
| 973 | `(lambda (process state) | 983 | `(lambda (process state) |
| 974 | (if (eq 'exit (process-status process)) | 984 | (when (eq 'exit (process-status process)) |
| 975 | (gnus-configure-windows | 985 | (ignore-errors (delete-file ,file)) |
| 976 | ',gnus-current-window-configuration)))) | 986 | (ignore-errors |
| 987 | (delete-directory ,(file-name-directory file))) | ||
| 988 | (gnus-configure-windows | ||
| 989 | ',gnus-current-window-configuration)))) | ||
| 977 | (gnus-configure-windows 'display-term)) | 990 | (gnus-configure-windows 'display-term)) |
| 978 | (mm-handle-set-external-undisplayer handle (cons file buffer))) | 991 | (mm-handle-set-external-undisplayer handle (cons file buffer)) |
| 992 | (add-to-list 'mm-temp-files-to-be-deleted file t)) | ||
| 979 | (message "Displaying %s..." command)) | 993 | (message "Displaying %s..." command)) |
| 980 | 'external) | 994 | 'external) |
| 981 | (copiousoutput | 995 | (copiousoutput |
| @@ -1021,15 +1035,14 @@ external if displayed external." | |||
| 1021 | (buffer buffer) | 1035 | (buffer buffer) |
| 1022 | (command command) | 1036 | (command command) |
| 1023 | (handle handle)) | 1037 | (handle handle)) |
| 1024 | (run-at-time | ||
| 1025 | 60.0 nil | ||
| 1026 | (lambda () | ||
| 1027 | (ignore-errors | ||
| 1028 | (delete-file file)) | ||
| 1029 | (ignore-errors | ||
| 1030 | (delete-directory (file-name-directory file))))) | ||
| 1031 | (lambda (process state) | 1038 | (lambda (process state) |
| 1032 | (when (eq (process-status process) 'exit) | 1039 | (when (eq (process-status process) 'exit) |
| 1040 | (run-at-time | ||
| 1041 | 60.0 nil | ||
| 1042 | (lambda () | ||
| 1043 | (ignore-errors (delete-file file)) | ||
| 1044 | (ignore-errors (delete-directory | ||
| 1045 | (file-name-directory file))))) | ||
| 1033 | (when (buffer-live-p outbuf) | 1046 | (when (buffer-live-p outbuf) |
| 1034 | (with-current-buffer outbuf | 1047 | (with-current-buffer outbuf |
| 1035 | (let ((buffer-read-only nil) | 1048 | (let ((buffer-read-only nil) |