From afc2b649cd2b26765f4a7fd4c6f3eac51c4018f5 Mon Sep 17 00:00:00 2001 From: Sacha Chua Date: Thu, 2 Jan 2025 14:52:28 -0500 Subject: [PATCH] image-dired-show-all-from-dir: Reuse dired's default-directory * 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. --- lisp/image/image-dired.el | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lisp/image/image-dired.el b/lisp/image/image-dired.el index 83745e88f09..06fbca6a3f7 100644 --- a/lisp/image/image-dired.el +++ b/lisp/image/image-dired.el @@ -630,7 +630,8 @@ image-dired-show-all-from-dir (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 @@ image-dired-show-all-from-dir (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"))))) -- 2.43.0