mm-decode.el (mm-temp-files-delete): Fix file deletion logic
authorKatsumi Yamaoka <yamaoka@jpl.org>
Wed, 28 Aug 2013 08:37:58 +0000 (08:37 +0000)
committerKatsumi Yamaoka <yamaoka@jpl.org>
Wed, 28 Aug 2013 08:37:58 +0000 (08:37 +0000)
lisp/ChangeLog
lisp/mm-decode.el

index ab5882a..dfb4d54 100644 (file)
@@ -1,3 +1,7 @@
+2013-08-28  Katsumi Yamaoka  <yamaoka@jpl.org>
+
+       * mm-decode.el (mm-temp-files-delete): Fix file deletion logic.
+
 2013-08-19  Katsumi Yamaoka  <yamaoka@jpl.org>
 
        * mm-util.el (mm-coding-system-priorities): Exclude iso-2022-jp-2 and
index dbbf0be..28d930b 100644 (file)
@@ -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.