emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master bb76ab015a: image-dired: Fix performance bug with mouse click


From: Stefan Kangas
Subject: master bb76ab015a: image-dired: Fix performance bug with mouse click
Date: Thu, 15 Sep 2022 16:27:22 -0400 (EDT)

branch: master
commit bb76ab015a247d2547a9e6778e50ffb38988f47e
Author: Stefan Kangas <stefankangas@gmail.com>
Commit: Stefan Kangas <stefankangas@gmail.com>

    image-dired: Fix performance bug with mouse click
    
    * lisp/image/image-dired.el
    (image-dired--on-file-in-dired-buffer): Move call to
    'image-dired-thumb-update-marks' from here...
    (image-dired--do-mark-command): ...to here.  Add new optional
    argument UPDATE to control calling it.  Update callers.
    (image-dired-mouse-toggle-mark-1): Fix performance bug by setting
    above new optional argument to nil.  (Bug#53599)
---
 lisp/image/image-dired.el | 24 +++++++++++++-----------
 1 file changed, 13 insertions(+), 11 deletions(-)

diff --git a/lisp/image/image-dired.el b/lisp/image/image-dired.el
index df4ee07133..12a94974b1 100644
--- a/lisp/image/image-dired.el
+++ b/lisp/image/image-dired.el
@@ -750,18 +750,20 @@ Should be called from commands in 
`image-dired-thumbnail-mode'."
          (message "No image, or image with correct properties, at point")
        (with-current-buffer dired-buf
          (when (dired-goto-file file-name)
-           ,@body
-           (image-dired-thumb-update-marks))))))
+           ,@body)))))
 
-(defmacro image-dired--do-mark-command (maybe-next &rest body)
+(defmacro image-dired--do-mark-command (maybe-next update &rest body)
   "Helper macro for the mark, unmark and flag commands.
 Run BODY in Dired buffer.
-If optional argument MAYBE-NEXT is non-nil, show next image
-according to `image-dired-marking-shows-next'."
+If MAYBE-NEXT is non-nil, show next image according to
+`image-dired-marking-shows-next'.
+If UPDATE is non-nil, call `image-dired-thumb-update-marks' too."
   (declare (indent defun) (debug t))
   `(image-dired--with-thumbnail-buffer
      (image-dired--on-file-in-dired-buffer
        ,@body)
+     ,(when update
+        '(image-dired-thumb-update-marks))
      ,(when maybe-next
         '(if image-dired-marking-shows-next
              (image-dired-display-next-thumbnail-original)
@@ -770,26 +772,26 @@ according to `image-dired-marking-shows-next'."
 (defun image-dired-mark-thumb-original-file ()
   "Mark original image file in associated Dired buffer."
   (interactive nil image-dired-thumbnail-mode image-dired-display-image-mode)
-  (image-dired--do-mark-command t
+  (image-dired--do-mark-command t t
     (dired-mark 1)))
 
 (defun image-dired-unmark-thumb-original-file ()
   "Unmark original image file in associated Dired buffer."
   (interactive nil image-dired-thumbnail-mode image-dired-display-image-mode)
-  (image-dired--do-mark-command t
+  (image-dired--do-mark-command t t
     (dired-unmark 1)))
 
 (defun image-dired-flag-thumb-original-file ()
   "Flag original image file for deletion in associated Dired buffer."
   (interactive nil image-dired-thumbnail-mode image-dired-display-image-mode)
-  (image-dired--do-mark-command t
+  (image-dired--do-mark-command t t
     (dired-flag-file-deletion 1)))
 
 (defun image-dired-unmark-all-marks ()
   "Remove all marks from all files in associated Dired buffer.
 Also update the marks in the thumbnail buffer."
   (interactive nil image-dired-thumbnail-mode image-dired-display-image-mode)
-  (image-dired--do-mark-command nil
+  (image-dired--do-mark-command nil t
     (dired-unmark-all-marks))
   (image-dired--with-thumbnail-buffer
     (image-dired-thumb-update-marks)))
@@ -1253,7 +1255,7 @@ Track this in associated Dired buffer if
 `image-dired-track-movement' is non-nil."
   (when image-dired-track-movement
     (image-dired-track-original-file))
-  (image-dired--do-mark-command nil
+  (image-dired--do-mark-command nil nil
     (if (image-dired-dired-file-marked-p)
         (dired-unmark 1)
       (dired-mark 1))))
@@ -1371,7 +1373,7 @@ completely fit)."
   "Toggle mark on original image file in associated Dired buffer."
   (declare (obsolete nil "29.1"))
   (interactive nil image-dired-thumbnail-mode image-dired-display-image-mode)
-  (image-dired--do-mark-command nil
+  (image-dired--do-mark-command nil t
     (if (image-dired-dired-file-marked-p)
         (dired-unmark 1)
       (dired-mark 1))))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]