]> git.eshelyaron.com Git - emacs.git/commitdiff
Do not error out on non image file (bug#61639)
authorManuel Giraud <manuel@ledu-giraud.fr>
Sun, 19 Feb 2023 20:03:57 +0000 (21:03 +0100)
committerEli Zaretskii <eliz@gnu.org>
Wed, 22 Feb 2023 13:20:45 +0000 (15:20 +0200)
* lisp/image/image-dired.el
(image-dired-display-thumbs): Do not insert non image file and do not
display image-dired buffer if it is empty.

lisp/image/image-dired.el

index 11632e7f28eda634313c783abe69a4b66639649a..8e2a75a418f9c35a4058bbbb485f6a6b136593e5 100644 (file)
@@ -585,13 +585,15 @@ thumbnail buffer to be selected."
               (erase-buffer))
           (goto-char (point-max)))
         (dolist (file files)
-          (let ((thumb (image-dired--get-create-thumbnail-file file)))
+          (when (string-match-p (image-dired--file-name-regexp) file)
             (image-dired-insert-thumbnail
-             thumb file dired-buf
+             (image-dired--get-create-thumbnail-file file) file dired-buf
              (cl-incf image-dired--number-of-thumbnails)))))
-      (if do-not-pop
-          (display-buffer buf)
-        (pop-to-buffer buf))
+      (if (> image-dired--number-of-thumbnails 0)
+          (if do-not-pop
+              (display-buffer buf)
+            (pop-to-buffer buf))
+        (message "No images selected"))
       (image-dired--line-up-with-method)
       (image-dired--update-header-line))))