emacs-diffs
[Top][All Lists]
Advanced

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

master 75ebbc6 1/2: image-dired: Don't show thumbnails if there are no i


From: Stefan Kangas
Subject: master 75ebbc6 1/2: image-dired: Don't show thumbnails if there are no image files
Date: Wed, 27 Oct 2021 16:44:53 -0400 (EDT)

branch: master
commit 75ebbc6a27e28227ab4a6b9f5ba114056478f885
Author: Stefan Kangas <stefan@marxist.se>
Commit: Stefan Kangas <stefan@marxist.se>

    image-dired: Don't show thumbnails if there are no image files
    
    * lisp/image-dired.el (image-dired-show-all-from-dir): Don't show
    thumbnail buffer if there are no image files.
---
 lisp/image-dired.el | 25 +++++++++++++------------
 1 file changed, 13 insertions(+), 12 deletions(-)

diff --git a/lisp/image-dired.el b/lisp/image-dired.el
index 1239821..250a76b 100644
--- a/lisp/image-dired.el
+++ b/lisp/image-dired.el
@@ -1140,18 +1140,19 @@ never ask for confirmation."
   (interactive "DImage Dired: ")
   (dired dir)
   (dired-mark-files-regexp (image-file-name-regexp))
-  (let ((files (dired-get-marked-files)))
-    (if (or (not image-dired-show-all-from-dir-max-files)
-            (<= (length files) image-dired-show-all-from-dir-max-files)
-            (and (> (length files) image-dired-show-all-from-dir-max-files)
-                 (y-or-n-p
-                  (format
-                   "Directory contains more than %d image files.  Proceed? "
-                   image-dired-show-all-from-dir-max-files))))
-        (progn
-          (image-dired-display-thumbs)
-          (pop-to-buffer image-dired-thumbnail-buffer))
-      (message "Canceled."))))
+  (let ((files (dired-get-marked-files nil nil nil t)))
+    (cond ((and (null (cdr files)))
+           (message "No image files in directory"))
+          ((or (not image-dired-show-all-from-dir-max-files)
+               (<= (length (cdr files)) 
image-dired-show-all-from-dir-max-files)
+               (and (> (length (cdr files)) 
image-dired-show-all-from-dir-max-files)
+                    (y-or-n-p
+                     (format
+                      "Directory contains more than %d image files.  Proceed?"
+                      image-dired-show-all-from-dir-max-files))))
+           (image-dired-display-thumbs)
+           (pop-to-buffer image-dired-thumbnail-buffer))
+          (t (message "Image-Dired canceled")))))
 
 ;;;###autoload
 (defalias 'image-dired 'image-dired-show-all-from-dir)



reply via email to

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