Subject: Re: bug#53599: 29.0.50; image-dired-mouse-toggle-mark very slow

From: Peter Münster <[email-masked]>
Date: Mon, 31 Jan 2022 10:02:03 +0100

On Fri, Jan 28 2022, Peter Münster wrote:

> What could be a good way to avoid the repeated calls to
> image-dired-thumb-update-marks please?

This works, but I don't know if it's not too hackish:

diff --git a/lisp/image-dired.el b/lisp/image-dired.el
index 9b0bbb70df..e5ccc17154 100644
--- a/lisp/image-dired.el
+++ b/lisp/image-dired.el
@@ -2392,17 +2390,20 @@ image-dired-mouse-toggle-mark
 Track this in associated Dired buffer if
 `image-dired-track-movement' is non-nil."
   (interactive "e")
-  (if (use-region-p)
-      (let ((end (region-end)))
-        (save-excursion
-          (goto-char (region-beginning))
-          (while (<= (point) end)
-            (when (image-dired-image-at-point-p)
-              (image-dired-mouse-toggle-mark-1))
-            (forward-char))))
-    (mouse-set-point event)
-    (goto-char (posn-point (event-end event)))
-    (image-dired-mouse-toggle-mark-1))
+  (let ((idtum-orig (symbol-function 'image-dired-thumb-update-marks)))
+    (defun image-dired-thumb-update-marks ())
+    (if (use-region-p)
+        (let ((end (region-end)))
+          (save-excursion
+            (goto-char (region-beginning))
+            (while (<= (point) end)
+              (when (image-dired-image-at-point-p)
+                (image-dired-mouse-toggle-mark-1))
+              (forward-char))))
+      (mouse-set-point event)
+      (goto-char (posn-point (event-end event)))
+      (image-dired-mouse-toggle-mark-1))
+    (fset 'image-dired-thumb-update-marks idtum-orig))
   (image-dired-thumb-update-marks))
 
 (defun image-dired-dired-display-properties ()

What do you think?

-- 
           Peter