* bug#58255: 29.0.50; don't remove thumbnails in image-dired-do-flagged-delete until confirmation
@ 2022-10-02 17:22 Peter Münster
2022-10-02 18:26 ` Stefan Kangas
0 siblings, 1 reply; 3+ messages in thread
From: Peter Münster @ 2022-10-02 17:22 UTC (permalink / raw)
To: 58255
[-- Attachment #1.1: Type: text/plain, Size: 251 bytes --]
Hi,
As suggested by Stefan Kangas, please find here attached a patch, that
changes image-dired-do-flagged-delete, so that thumbnails are removed
only, when images are actually deleted in the dired buffer.
Kind regards,
--
Peter
[-- Attachment #1.2: my-patch.diff --]
[-- Type: text/x-patch, Size: 1743 bytes --]
commit 5d117180ae038fde0732a96451bb588433a3ad38
Author: Peter Münster <pm@a16n.net>
Date: Sun Oct 2 19:17:51 2022 +0200
Don't remove thumbnails in image-dired-do-flagged-delete until confirmation
* lisp/image/image-dired.el (image-dired-do-flagged-delete): Delete
thumbnails only when original images disappear.
diff --git a/lisp/image/image-dired.el b/lisp/image/image-dired.el
index 8fb89d4502..33f7149dec 100644
--- a/lisp/image/image-dired.el
+++ b/lisp/image/image-dired.el
@@ -1347,17 +1347,21 @@ image-dired-do-flagged-delete
(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
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 211 bytes --]
^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2022-10-02 19:36 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-10-02 17:22 bug#58255: 29.0.50; don't remove thumbnails in image-dired-do-flagged-delete until confirmation Peter Münster
2022-10-02 18:26 ` Stefan Kangas
2022-10-02 19:36 ` Peter Münster
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.