From: Eli Zaretskii Date: Sun, 12 Jun 2022 10:03:32 +0000 (+0300) Subject: Fix "C-x C-d" with wildcard arguments X-Git-Tag: emacs-29.0.90~1910^2~58 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=dc5f6dcee22982906eb09037ee04471b34bb4be7;p=emacs.git 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) --- 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.