From 8a2bfb0bcfbea15211b451ad6e472d8aa4c64603 Mon Sep 17 00:00:00 2001 From: Katsumi Yamaoka Date: Wed, 28 Aug 2013 08:37:58 +0000 Subject: [PATCH] mm-decode.el (mm-temp-files-delete): Fix file deletion logic --- lisp/ChangeLog | 4 ++++ lisp/mm-decode.el | 22 +++++++++++----------- 2 files changed, 15 insertions(+), 11 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index ab5882a1f..dfb4d54a1 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,7 @@ +2013-08-28 Katsumi Yamaoka + + * mm-decode.el (mm-temp-files-delete): Fix file deletion logic. + 2013-08-19 Katsumi Yamaoka * mm-util.el (mm-coding-system-priorities): Exclude iso-2022-jp-2 and diff --git a/lisp/mm-decode.el b/lisp/mm-decode.el index dbbf0befe..28d930b55 100644 --- a/lisp/mm-decode.el +++ b/lisp/mm-decode.el @@ -607,19 +607,19 @@ files left at the next time." (split-string (buffer-string) "\n" t)))) fails) (dolist (temp (append cache mm-temp-files-to-be-deleted)) - (unless (and (file-exists-p temp) - (if (file-directory-p temp) - ;; A parent directory left at the previous time. + (when (and (file-exists-p temp) + (if (file-directory-p temp) + ;; A parent directory left at the previous time. + (progn + (ignore-errors (delete-directory temp)) + (file-exists-p temp)) + ;; Delete a temporary file and its parent directory. + (ignore-errors (delete-file temp)) + (or (file-exists-p temp) (progn + (setq temp (file-name-directory temp)) (ignore-errors (delete-directory temp)) - (not (file-exists-p temp))) - ;; Delete a temporary file and its parent directory. - (ignore-errors (delete-file temp)) - (and (not (file-exists-p temp)) - (progn - (setq temp (file-name-directory temp)) - (ignore-errors (delete-directory temp)) - (not (file-exists-p temp)))))) + (file-exists-p temp))))) (push temp fails))) (if fails ;; Schedule the deletion of the files left at the next time. -- 2.34.1