GNU bug report logs - #53599
29.0.50; image-dired-mouse-toggle-mark very slow

Previous Next

Package: emacs;

Reported by: Peter Münster <pm <at> a16n.net>

Date: Fri, 28 Jan 2022 09:48:01 UTC

Severity: normal

Found in version 29.0.50

Fixed in version 29.1

Done: Stefan Kangas <stefankangas <at> gmail.com>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 53599 in the body.
You can then email your comments to 53599 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#53599; Package emacs. (Fri, 28 Jan 2022 09:48:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Peter Münster <pm <at> a16n.net>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Fri, 28 Jan 2022 09:48:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Peter Münster <pm <at> a16n.net>
To: Emacs Bugs <bug-gnu-emacs <at> gnu.org>
Subject: 29.0.50; image-dired-mouse-toggle-mark very slow
Date: Fri, 28 Jan 2022 10:47:19 +0100
[Message part 1 (text/plain, inline)]
Hi,

When using a buffer with about 5000 images,
image-dired-mouse-toggle-mark takes about 1-2 seconds for one image.

This is not a big problem. But when using this function on a region with
about 200 images, then you need to wait several minutes for completion.

That's because image-dired-thumb-update-marks is called in the macro
image-dired--on-file-in-dired-buffer and therefore unnecessarily for
each image in the region.

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

TIA for any help,
-- 
           Peter
[signature.asc (application/pgp-signature, inline)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#53599; Package emacs. (Mon, 31 Jan 2022 09:03:01 GMT) Full text and rfc822 format available.

Message #8 received at 53599 <at> debbugs.gnu.org (full text, mbox):

From: Peter Münster <pm <at> a16n.net>
To: 53599 <at> debbugs.gnu.org
Subject: Re: bug#53599: 29.0.50; image-dired-mouse-toggle-mark very slow
Date: Mon, 31 Jan 2022 10:02:03 +0100
[Message part 1 (text/plain, inline)]
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
[signature.asc (application/pgp-signature, inline)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#53599; Package emacs. (Thu, 15 Sep 2022 17:58:01 GMT) Full text and rfc822 format available.

Message #11 received at 53599 <at> debbugs.gnu.org (full text, mbox):

From: Peter Münster <pm <at> a16n.net>
To: 53599 <at> debbugs.gnu.org
Subject: Re: bug#53599: 29.0.50; image-dired-mouse-toggle-mark very slow
Date: Thu, 15 Sep 2022 19:57:34 +0200
[Message part 1 (text/plain, inline)]
On Mon, Jan 31 2022, Peter Münster wrote:

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

And here for the latest master:

diff --git a/lisp/image/image-dired.el b/lisp/image/image-dired.el
index 75dcdd8cbc..0218cd4038 100644
--- a/lisp/image/image-dired.el
+++ b/lisp/image/image-dired.el
@@ -1269,15 +1269,18 @@ 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))

What do you think?

-- 
           Peter
[signature.asc (application/pgp-signature, inline)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#53599; Package emacs. (Thu, 15 Sep 2022 20:40:02 GMT) Full text and rfc822 format available.

Message #14 received at 53599 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Kangas <stefankangas <at> gmail.com>
To: Peter Münster <pm <at> a16n.net>, 53599 <at> debbugs.gnu.org
Subject: Re: bug#53599: 29.0.50; image-dired-mouse-toggle-mark very slow
Date: Thu, 15 Sep 2022 13:39:30 -0700
tags 53599 + pending
thanks

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

> And here for the latest master:

Thanks for the updated patch, as well as the very good bug report that
indicated clearly not just how to reproduce it but also the root cause.

However, I think we should avoid mocking out that function, so I
attempted to solve this in a more clean way on master.  Could you please
rebuild latest master, and verify that the bug is fixed for you too?




Added tag(s) pending. Request was from Stefan Kangas <stefankangas <at> gmail.com> to control <at> debbugs.gnu.org. (Thu, 15 Sep 2022 20:40:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#53599; Package emacs. (Fri, 16 Sep 2022 05:10:02 GMT) Full text and rfc822 format available.

Message #19 received at 53599 <at> debbugs.gnu.org (full text, mbox):

From: Peter Münster <pm <at> a16n.net>
To: Stefan Kangas <stefankangas <at> gmail.com>
Cc: 53599 <at> debbugs.gnu.org
Subject: Re: bug#53599: 29.0.50; image-dired-mouse-toggle-mark very slow
Date: Fri, 16 Sep 2022 07:09:12 +0200
[Message part 1 (text/plain, inline)]
On Thu, Sep 15 2022, Stefan Kangas wrote:

> However, I think we should avoid mocking out that function, so I
> attempted to solve this in a more clean way on master.  Could you please
> rebuild latest master, and verify that the bug is fixed for you too?

Yes, it works well. Thanks!

-- 
           Peter
[signature.asc (application/pgp-signature, inline)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#53599; Package emacs. (Fri, 16 Sep 2022 09:55:02 GMT) Full text and rfc822 format available.

Message #22 received at 53599 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Kangas <stefankangas <at> gmail.com>
To: Peter Münster <pm <at> a16n.net>
Cc: 53599 <at> debbugs.gnu.org
Subject: Re: bug#53599: 29.0.50; image-dired-mouse-toggle-mark very slow
Date: Fri, 16 Sep 2022 02:54:18 -0700
close 53599 29.1
thanks

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

> Yes, it works well. Thanks!

Thanks for testing!  I'm therefore closing this bug report.




bug marked as fixed in version 29.1, send any further explanations to 53599 <at> debbugs.gnu.org and Peter Münster <pm <at> a16n.net> Request was from Stefan Kangas <stefankangas <at> gmail.com> to control <at> debbugs.gnu.org. (Fri, 16 Sep 2022 09:55:03 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Fri, 14 Oct 2022 11:24:09 GMT) Full text and rfc822 format available.

This bug report was last modified 1 year and 185 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.