bug-gnu-emacs
[Top][All Lists]
Advanced

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

bug#57281: [PATCH] Speed up image-dired-display-image


From: Morgan . J . Smith
Subject: bug#57281: [PATCH] Speed up image-dired-display-image
Date: Thu, 18 Aug 2022 14:43:07 -0400

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






reply via email to

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