unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* 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

* bug#58255: 29.0.50; don't remove thumbnails in image-dired-do-flagged-delete until confirmation
  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
  0 siblings, 1 reply; 3+ messages in thread
From: Stefan Kangas @ 2022-10-02 18:26 UTC (permalink / raw)
  To: Peter Münster, 58255

tags 58255 + patch
close 58255 29.1
thanks

Peter Münster <pm@a16n.net> writes:

> 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.

Thanks for the patch!  It looks good to me, so I've installed it on
master.

In the future, please use `git format-patch -1 HEAD' to produce the
patch, as that makes it easier to install.





^ permalink raw reply	[flat|nested] 3+ messages in thread

* bug#58255: 29.0.50; don't remove thumbnails in image-dired-do-flagged-delete until confirmation
  2022-10-02 18:26 ` Stefan Kangas
@ 2022-10-02 19:36   ` Peter Münster
  0 siblings, 0 replies; 3+ messages in thread
From: Peter Münster @ 2022-10-02 19:36 UTC (permalink / raw)
  To: Stefan Kangas; +Cc: 58255

[-- Attachment #1: Type: text/plain, Size: 165 bytes --]

On Sun, Oct 02 2022, Stefan Kangas wrote:

> In the future, please use `git format-patch -1 HEAD'

Sorry. Yes, I'll do that next time.

-- 
           Peter

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 211 bytes --]

^ permalink raw reply	[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 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).