]> git.eshelyaron.com Git - emacs.git/commitdiff
Fix agent directory deletion
authorLars Ingebrigtsen <larsi@gnus.org>
Sun, 3 Oct 2021 09:28:27 +0000 (11:28 +0200)
committerLars Ingebrigtsen <larsi@gnus.org>
Sun, 3 Oct 2021 09:28:34 +0000 (11:28 +0200)
* lisp/gnus/gnus-agent.el (gnus-agent-expire-unagentized-dirs):
Delete directories in a simpler way that actually works (bug#50986).

lisp/gnus/gnus-agent.el

index 19d05120045f9cb4b8d3351b5a09ca8e68ddf124..6426d8254650c82ca617e7240a3eddfa9c65fe36 100644 (file)
@@ -3553,32 +3553,13 @@ articles in every agentized group? "))
       (when (and to-remove
                  (or gnus-expert-user
                      (gnus-y-or-n-p
-                      "gnus-agent-expire has identified local directories that are\
- not currently required by any agentized group.  Do you wish to consider\
- deleting them?")))
-        (while to-remove
-          (let ((dir (pop to-remove)))
-            (if (or gnus-expert-user
+                      "gnus-agent-expire has identified local directories that are
+not currently required by any agentized group.  Do you wish to consider
+deleting them?")))
+        (dolist (dir to-remove)
+          (when (or gnus-expert-user
                    (gnus-y-or-n-p (format "Delete %s? " dir)))
-                (let* (delete-recursive
-                      files f
-                       (delete-recursive
-                        (lambda (f-or-d)
-                          (ignore-errors
-                            (if (file-directory-p f-or-d)
-                                (condition-case nil
-                                    (delete-directory f-or-d)
-                                  (file-error
-                                   (setq files (directory-files f-or-d))
-                                   (while files
-                                     (setq f (pop files))
-                                     (or (member f '("." ".."))
-                                         (funcall delete-recursive
-                                                  (nnheader-concat
-                                                   f-or-d f))))
-                                   (delete-directory f-or-d)))
-                              (delete-file f-or-d))))))
-                  (funcall delete-recursive dir)))))))))
+            (delete-directory dir t)))))))
 
 ;;;###autoload
 (defun gnus-agent-batch ()