From: Peter Münster Date: Sun, 2 Oct 2022 18:12:32 +0000 (+0200) Subject: Delete thumbs in image-dired-do-flagged-delete after confirmation X-Git-Tag: emacs-29.0.90~1856^2~74 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=d4f56e96665f1d2d98ce645d32d587013e8b8116;p=emacs.git Delete thumbs in image-dired-do-flagged-delete after confirmation * lisp/image/image-dired.el (image-dired-do-flagged-delete): Remove thumbnails only after confirming deletion of the files. (Bug#58255) --- diff --git a/lisp/image/image-dired.el b/lisp/image/image-dired.el index 8fb89d45023..c9d67411409 100644 --- a/lisp/image/image-dired.el +++ b/lisp/image/image-dired.el @@ -1347,17 +1347,21 @@ for deletion instead." (interactive nil image-dired-thumbnail-mode) (unless (derived-mode-p 'image-dired-thumbnail-mode) (user-error "Not in `image-dired-thumbnail-mode'")) - (let ((inhibit-read-only t)) - (goto-char (point-min)) - (while (not (eobp)) - (if (image-dired-thumb-file-flagged-p) - (progn - (delete-char 1) - (forward-char)) - (forward-char 2)))) - (image-dired--line-up-with-method) - (image-dired--on-file-in-dired-buffer - (dired-do-flagged-delete))) + (image-dired--with-dired-buffer + (dired-do-flagged-delete)) + (let (deletions) + (save-excursion + (let ((inhibit-read-only t)) + (goto-char (point-min)) + (while (not (eobp)) + (let ((file-name (image-dired-original-file-name))) + (if (image-dired--with-dired-buffer (dired-goto-file file-name)) + (forward-char 2) + (delete-char 1) + (forward-char) + (setq deletions t)))))) + (if deletions + (image-dired--line-up-with-method)))) (defun image-dired--thumb-update-mark-at-point () (with-silent-modifications