* bug#53599: 29.0.50; image-dired-mouse-toggle-mark very slow
@ 2022-01-28 9:47 Peter Münster
2022-01-31 9:02 ` Peter Münster
0 siblings, 1 reply; 6+ messages in thread
From: Peter Münster @ 2022-01-28 9:47 UTC (permalink / raw)
To: 53599
[-- Attachment #1: Type: text/plain, Size: 583 bytes --]
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
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 211 bytes --]
^ permalink raw reply [flat|nested] 6+ messages in thread
* bug#53599: 29.0.50; image-dired-mouse-toggle-mark very slow
2022-01-28 9:47 bug#53599: 29.0.50; image-dired-mouse-toggle-mark very slow Peter Münster
@ 2022-01-31 9:02 ` Peter Münster
2022-09-15 17:57 ` Peter Münster
0 siblings, 1 reply; 6+ messages in thread
From: Peter Münster @ 2022-01-31 9:02 UTC (permalink / raw)
To: 53599
[-- Attachment #1: Type: text/plain, Size: 1687 bytes --]
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
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 211 bytes --]
^ permalink raw reply related [flat|nested] 6+ messages in thread
* bug#53599: 29.0.50; image-dired-mouse-toggle-mark very slow
2022-01-31 9:02 ` Peter Münster
@ 2022-09-15 17:57 ` Peter Münster
2022-09-15 20:39 ` Stefan Kangas
0 siblings, 1 reply; 6+ messages in thread
From: Peter Münster @ 2022-09-15 17:57 UTC (permalink / raw)
To: 53599
[-- Attachment #1: Type: text/plain, Size: 1593 bytes --]
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
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 211 bytes --]
^ permalink raw reply related [flat|nested] 6+ messages in thread
* bug#53599: 29.0.50; image-dired-mouse-toggle-mark very slow
2022-09-15 17:57 ` Peter Münster
@ 2022-09-15 20:39 ` Stefan Kangas
2022-09-16 5:09 ` Peter Münster
0 siblings, 1 reply; 6+ messages in thread
From: Stefan Kangas @ 2022-09-15 20:39 UTC (permalink / raw)
To: Peter Münster, 53599
tags 53599 + pending
thanks
Peter Münster <pm@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?
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2022-09-16 9:54 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-01-28 9:47 bug#53599: 29.0.50; image-dired-mouse-toggle-mark very slow Peter Münster
2022-01-31 9:02 ` Peter Münster
2022-09-15 17:57 ` Peter Münster
2022-09-15 20:39 ` Stefan Kangas
2022-09-16 5:09 ` Peter Münster
2022-09-16 9:54 ` Stefan Kangas
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.