]> git.eshelyaron.com Git - emacs.git/commitdiff
image-dired-show-all-from-dir: Reuse dired's default-directory
authorSacha Chua <sacha@sachachua.com>
Thu, 2 Jan 2025 19:52:28 +0000 (14:52 -0500)
committerEshel Yaron <me@eshelyaron.com>
Wed, 8 Jan 2025 08:52:52 +0000 (09:52 +0100)
* lisp/image/image-dired.el (image-dired-show-all-from-dir): Delegate
figuring out default-directory to dired.  This handles the case where
image-dired is called with a cons cell that has a directory in the car
and a list of files in the cdr, which dired can handle, and therefore
allows image-dired-show-all-from-dir to show an arbitrary list of
images.  It also means that image-dired-show-all-from-dir can handle
wildcards.
Ref: https://lists.gnu.org/r/emacs-devel/2025-01/msg00048.html

(cherry picked from commit d4503ccc2769035184e474542fc6c1df7e908ae0)

lisp/image/image-dired.el

index 841170d202ee9295c6760d7bed2bd21f6cfa86b7..3ff904df71b5c199da4e77931c3aaf4b6a7d5f16 100644 (file)
@@ -630,7 +630,8 @@ never ask for confirmation."
   (interactive "DShow thumbnails for directory: ")
   (dired dir)
   (dired-mark-files-regexp (image-dired--file-name-regexp))
-  (let ((files (dired-get-marked-files nil nil nil t)))
+  (let ((files (dired-get-marked-files nil nil nil t))
+        (dired-default-directory default-directory))
     (cond ((and (null (cdr files)))
            (message "No image files in directory"))
           ((or (not image-dired-show-all-from-dir-max-files)
@@ -644,7 +645,7 @@ never ask for confirmation."
            (let ((inhibit-message t))
              (dired-unmark-all-marks))
            (pop-to-buffer image-dired-thumbnail-buffer)
-           (setq default-directory dir)
+           (setq default-directory dired-default-directory)
            (image-dired--update-header-line))
           (t (message "Image-Dired canceled")))))