# HG changeset patch # User Richard M. Stallman # Date 1016425845 0 # Node ID 477ed75a821bbd569a4d695bcdd166b4b7dbd826 # Parent 7bb1231179325f1b3c88318884c42486df56a594 (list-directory): Set default-directory at the end. diff -r 7bb123117932 -r 477ed75a821b lisp/files.el --- a/lisp/files.el Mon Mar 18 04:29:13 2002 +0000 +++ b/lisp/files.el Mon Mar 18 04:30:45 2002 +0000 @@ -3538,22 +3538,26 @@ nil default-directory nil) pfx))) (let ((switches (if verbose list-directory-verbose-switches - list-directory-brief-switches))) + list-directory-brief-switches)) + buffer) (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) (terpri) (save-excursion (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.