From: "Peter Münster" <pm@a16n.net>
To: 58255@debbugs.gnu.org
Subject: bug#58255: 29.0.50; don't remove thumbnails in image-dired-do-flagged-delete until confirmation
Date: Sun, 02 Oct 2022 19:22:47 +0200 [thread overview]
Message-ID: <87tu4mxhqw.fsf@a16n.net> (raw)
[-- 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 --]
next reply other threads:[~2022-10-02 17:22 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-10-02 17:22 Peter Münster [this message]
2022-10-02 18:26 ` bug#58255: 29.0.50; don't remove thumbnails in image-dired-do-flagged-delete until confirmation Stefan Kangas
2022-10-02 19:36 ` Peter Münster
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87tu4mxhqw.fsf@a16n.net \
--to=pm@a16n.net \
--cc=58255@debbugs.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).