From: Manuel Giraud Date: Sun, 19 Feb 2023 20:03:57 +0000 (+0100) Subject: Do not error out on non image file (bug#61639) X-Git-Tag: emacs-29.0.90~355^2~4 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=1f4886fdb09;p=emacs.git Do not error out on non image file (bug#61639) * 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. --- diff --git a/lisp/image/image-dired.el b/lisp/image/image-dired.el index 11632e7f28e..8e2a75a418f 100644 --- a/lisp/image/image-dired.el +++ b/lisp/image/image-dired.el @@ -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))))