Commit 84905190 authored by Richard M. Stallman's avatar Richard M. Stallman
Browse files

(list-directory): Set default-directory at the end.

parent da4f2a4d
......@@ -3538,22 +3538,26 @@ and `list-directory-verbose-switches'."
nil default-directory nil)
(let ((switches (if verbose list-directory-verbose-switches
(or dirname (setq dirname default-directory))
(setq dirname (expand-file-name dirname))
(with-output-to-temp-buffer "*Directory*"
(setq buffer standard-output)
(buffer-disable-undo standard-output)
(princ "Directory ")
(princ dirname)
(set-buffer "*Directory*")
(setq default-directory
(if (file-directory-p dirname)
(file-name-as-directory dirname)
(file-name-directory dirname)))
(let ((wildcard (not (file-directory-p dirname))))
(insert-directory dirname switches wildcard (not wildcard)))))))
(insert-directory dirname switches wildcard (not wildcard)))))
;; Finishing with-output-to-temp-buffer seems to clobber default-directory.
(with-current-buffer buffer
(setq default-directory
(if (file-directory-p dirname)
(file-name-as-directory dirname)
(file-name-directory dirname))))))
(defun shell-quote-wildcard-pattern (pattern)
"Quote characters special to the shell in PATTERN, leave wildcards alone.
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment