From efa44122aa6df377f9165f4bba740714e9f803c4 Mon Sep 17 00:00:00 2001 From: Katsumi Yamaoka Date: Wed, 28 Aug 2013 08:38:28 +0000 Subject: [PATCH] lisp/gnus/mm-decode.el (mm-temp-files-delete): Fix file deletion logic --- lisp/gnus/ChangeLog | 4 ++++ lisp/gnus/mm-decode.el | 22 +++++++++++----------- 2 files changed, 15 insertions(+), 11 deletions(-) diff --git a/lisp/gnus/ChangeLog b/lisp/gnus/ChangeLog index 950b73666e2..c75588536a4 100644 --- a/lisp/gnus/ChangeLog +++ b/lisp/gnus/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/gnus/mm-decode.el b/lisp/gnus/mm-decode.el index dbbf0befe60..28d930b55f7 100644 --- a/lisp/gnus/mm-decode.el +++ b/lisp/gnus/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.39.2