diff options
| author | Lars Ingebrigtsen | 2021-10-03 11:28:27 +0200 |
|---|---|---|
| committer | Lars Ingebrigtsen | 2021-10-03 11:28:34 +0200 |
| commit | b47d7ce1b87ee8bbbb04ce2b784af57ece17177f (patch) | |
| tree | 1967313786eb55e1d7fcfc2ee8596ddb1ce33a91 | |
| parent | b1a8a66fb0f28cba607831862fa673666a47bb2c (diff) | |
| download | emacs-b47d7ce1b87ee8bbbb04ce2b784af57ece17177f.tar.gz emacs-b47d7ce1b87ee8bbbb04ce2b784af57ece17177f.zip | |
Fix agent directory deletion
* lisp/gnus/gnus-agent.el (gnus-agent-expire-unagentized-dirs):
Delete directories in a simpler way that actually works (bug#50986).
| -rw-r--r-- | lisp/gnus/gnus-agent.el | 31 |
1 files changed, 6 insertions, 25 deletions
diff --git a/lisp/gnus/gnus-agent.el b/lisp/gnus/gnus-agent.el index 19d05120045..6426d825465 100644 --- a/lisp/gnus/gnus-agent.el +++ b/lisp/gnus/gnus-agent.el | |||
| @@ -3553,32 +3553,13 @@ articles in every agentized group? ")) | |||
| 3553 | (when (and to-remove | 3553 | (when (and to-remove |
| 3554 | (or gnus-expert-user | 3554 | (or gnus-expert-user |
| 3555 | (gnus-y-or-n-p | 3555 | (gnus-y-or-n-p |
| 3556 | "gnus-agent-expire has identified local directories that are\ | 3556 | "gnus-agent-expire has identified local directories that are |
| 3557 | not currently required by any agentized group. Do you wish to consider\ | 3557 | not currently required by any agentized group. Do you wish to consider |
| 3558 | deleting them?"))) | 3558 | deleting them?"))) |
| 3559 | (while to-remove | 3559 | (dolist (dir to-remove) |
| 3560 | (let ((dir (pop to-remove))) | 3560 | (when (or gnus-expert-user |
| 3561 | (if (or gnus-expert-user | ||
| 3562 | (gnus-y-or-n-p (format "Delete %s? " dir))) | 3561 | (gnus-y-or-n-p (format "Delete %s? " dir))) |
| 3563 | (let* (delete-recursive | 3562 | (delete-directory dir t))))))) |
| 3564 | files f | ||
| 3565 | (delete-recursive | ||
| 3566 | (lambda (f-or-d) | ||
| 3567 | (ignore-errors | ||
| 3568 | (if (file-directory-p f-or-d) | ||
| 3569 | (condition-case nil | ||
| 3570 | (delete-directory f-or-d) | ||
| 3571 | (file-error | ||
| 3572 | (setq files (directory-files f-or-d)) | ||
| 3573 | (while files | ||
| 3574 | (setq f (pop files)) | ||
| 3575 | (or (member f '("." "..")) | ||
| 3576 | (funcall delete-recursive | ||
| 3577 | (nnheader-concat | ||
| 3578 | f-or-d f)))) | ||
| 3579 | (delete-directory f-or-d))) | ||
| 3580 | (delete-file f-or-d)))))) | ||
| 3581 | (funcall delete-recursive dir))))))))) | ||
| 3582 | 3563 | ||
| 3583 | ;;;###autoload | 3564 | ;;;###autoload |
| 3584 | (defun gnus-agent-batch () | 3565 | (defun gnus-agent-batch () |