]> git.eshelyaron.com Git - emacs.git/commitdiff
Fix "C-x C-d" with wildcard arguments
authorEli Zaretskii <eliz@gnu.org>
Sun, 12 Jun 2022 10:03:32 +0000 (13:03 +0300)
committerEli Zaretskii <eliz@gnu.org>
Sun, 12 Jun 2022 10:03:32 +0000 (13:03 +0300)
* lisp/files.el (list-directory): Make sure 'default-directory' is
set to a valid value if the argument DIRNAME included wildcards.
(Bug#55877)

lisp/files.el

index 75a856c6362b412aa4b352208783c696c01cb406..945b7ef73716141f618d51776eb8685cc4de2216 100644 (file)
@@ -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.