* bug#57281: [PATCH] Speed up image-dired-display-image
@ 2022-08-18 18:43 Morgan.J.Smith
2022-08-19 5:53 ` Stefan Kangas
0 siblings, 1 reply; 2+ messages in thread
From: Morgan.J.Smith @ 2022-08-18 18:43 UTC (permalink / raw)
To: 57281; +Cc: Morgan Smith
From: Morgan Smith <Morgan.J.Smith@outlook.com>
* lisp/image-dired.el (image-dired-display-image): Open file literally
so we don't run image-mode twice
---
find-file-other-window runs image-mode and so does
image-dired-display-image-mode. By opening the file literally I was able to
speed this up from taking 0.8ish seconds to only taking 0.4ish seconds
according to elp
0.4 seconds is still a long time though. At a later time I might try to see if
there are more optimizations to make
lisp/image-dired.el | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/lisp/image-dired.el b/lisp/image-dired.el
index 93cce33c2b..5a747f4970 100644
--- a/lisp/image-dired.el
+++ b/lisp/image-dired.el
@@ -1978,8 +1978,8 @@ based on `image-mode'."
(cur-win (selected-window)))
(when buf
(kill-buffer buf))
- (when-let ((buf (find-file-other-window file)))
- (display-buffer buf)
+ (when-let ((buf (find-file-noselect file nil t)))
+ (switch-to-buffer-other-window buf)
(rename-buffer image-dired-display-image-buffer)
(image-dired-display-image-mode)
(select-window cur-win))))
--
2.37.2
^ permalink raw reply related [flat|nested] 2+ messages in thread
* bug#57281: [PATCH] Speed up image-dired-display-image
2022-08-18 18:43 bug#57281: [PATCH] Speed up image-dired-display-image Morgan.J.Smith
@ 2022-08-19 5:53 ` Stefan Kangas
0 siblings, 0 replies; 2+ messages in thread
From: Stefan Kangas @ 2022-08-19 5:53 UTC (permalink / raw)
To: Morgan.J.Smith; +Cc: 57281
close 57281 29.1
thanks
Morgan.J.Smith@outlook.com writes:
> find-file-other-window runs image-mode and so does
> image-dired-display-image-mode. By opening the file literally I was able to
> speed this up from taking 0.8ish seconds to only taking 0.4ish seconds
> according to elp
>
> 0.4 seconds is still a long time though. At a later time I might try to see if
> there are more optimizations to make
I can verify this speedup. Thanks for the patch, pushed to master (note
that I changed `switch-to-buffer-other-window' to `pop-to-buffer').
For your next patch, please consider producing it using "git
format-patch -1 HEAD" and send it as an attachment. It makes it easier
for us to install it. Thanks in advance.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-08-19 5:53 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-08-18 18:43 bug#57281: [PATCH] Speed up image-dired-display-image Morgan.J.Smith
2022-08-19 5:53 ` Stefan Kangas
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).