Subject: Re: bug#51763: 27.2; Displaying many images take all memory

From: Thierry Volpiatto <[email-masked]>
Date: Sat, 13 Nov 2021 07:32:18 +0000

Stefan Kangas <[email-masked]> writes:

> Relatedly, image-mode could be smarter, and evict images manually from
> the cache.  Let's say that when flipping through images in a directory,
> we only keep the previous N images (where N is, like, 5 or something).

I did this in helm and it works fine.

Also in image-dired when images are too large emacs ask for something
like "file too large really open yes no etc...", this because you use
`find-file-other-window` instead of `find-file-noselect`, do you want me
to open another issue for this? (patch below otherwise):

diff --git a/lisp/image-dired.el b/lisp/image-dired.el
index a2c37f00f23..fed23fb1830 100644
--- a/lisp/image-dired.el
+++ b/lisp/image-dired.el
@@ -1942,10 +1942,11 @@ based on `image-mode'."
         (cur-win (selected-window)))
     (when buf
       (kill-buffer buf))
-    (when-let ((buf (find-file-other-window file)))
+    (when-let ((buf (find-file-noselect file t)))
       (display-buffer buf)
-      (rename-buffer image-dired-display-image-buffer)
-      (image-dired-display-image-mode)
+      (with-current-buffer buf
+        (rename-buffer image-dired-display-image-buffer)
+        (image-dired-display-image-mode))
       (select-window cur-win))))
 
 (defun image-dired-display-thumbnail-original-image (&optional arg)

-- 
Thierry