summaryrefslogtreecommitdiff
path: root/lisp
diff options
context:
space:
mode:
authorEli Zaretskii <eliz@gnu.org>2022-06-12 13:03:32 +0300
committerEli Zaretskii <eliz@gnu.org>2022-06-12 13:03:32 +0300
commitdc5f6dcee22982906eb09037ee04471b34bb4be7 (patch)
treef21cab12d851a481dd67c423af087455d98a288c /lisp
parent5bf409329b1b678c633c79456288a1c4d6f0e804 (diff)
downloademacs-dc5f6dcee22982906eb09037ee04471b34bb4be7.tar.gz
emacs-dc5f6dcee22982906eb09037ee04471b34bb4be7.tar.bz2
emacs-dc5f6dcee22982906eb09037ee04471b34bb4be7.zip
Fix "C-x C-d" with wildcard arguments
* lisp/files.el (list-directory): Make sure 'default-directory' is set to a valid value if the argument DIRNAME included wildcards. (Bug#55877)
Diffstat (limited to 'lisp')
-rw-r--r--lisp/files.el4
1 files changed, 2 insertions, 2 deletions
diff --git a/lisp/files.el b/lisp/files.el
index 75a856c6362..945b7ef7371 100644
--- a/lisp/files.el
+++ b/lisp/files.el
@@ -7406,9 +7406,9 @@ and `list-directory-verbose-switches'."
;; Finishing with-output-to-temp-buffer seems to clobber default-directory.
(with-current-buffer buffer
(setq default-directory
- (if (file-directory-p dirname)
+ (if (file-accessible-directory-p dirname)
(file-name-as-directory dirname)
- (file-name-directory dirname))))))
+ (file-name-directory (directory-file-name dirname)))))))
(defun shell-quote-wildcard-pattern (pattern)
"Quote characters special to the shell in PATTERN, leave wildcards alone.