summaryrefslogtreecommitdiff
path: root/lisp/dired.el
diff options
context:
space:
mode:
authorRichard M. Stallman <rms@gnu.org>1997-04-13 04:26:38 +0000
committerRichard M. Stallman <rms@gnu.org>1997-04-13 04:26:38 +0000
commit3af790c070c9adca01fdc337c877b60876354d44 (patch)
tree3f3633f431657914fb150bc103979771a59fb6ea /lisp/dired.el
parent639d3eb2240329ef71bd5116dd96f5f6eac90971 (diff)
downloademacs-3af790c070c9adca01fdc337c877b60876354d44.tar.gz
(dired-noselect): Avoid calling file-directory-p
when the initial argument was syntactically a directory name.
Diffstat (limited to 'lisp/dired.el')
-rw-r--r--lisp/dired.el14
1 files changed, 11 insertions, 3 deletions
diff --git a/lisp/dired.el b/lisp/dired.el
index 470a970dd28..3792af9727a 100644
--- a/lisp/dired.el
+++ b/lisp/dired.el
@@ -410,16 +410,24 @@ If DIRNAME is already in a dired buffer, that buffer is used without refresh."
(or dir-or-list (setq dir-or-list default-directory))
;; This loses the distinction between "/foo/*/" and "/foo/*" that
;; some shells make:
- (let (dirname)
+ (let (dirname initially-was-dirname)
(if (consp dir-or-list)
(setq dirname (car dir-or-list))
(setq dirname dir-or-list))
+ (setq initially-was-dirname
+ (string= (file-name-as-directory dirname) dirname))
(setq dirname (abbreviate-file-name
(expand-file-name (directory-file-name dirname))))
(if find-file-visit-truename
(setq dirname (file-truename dirname)))
- (if (file-directory-p dirname)
- (setq dirname (file-name-as-directory dirname)))
+ ;; If the argument was syntactically a directory name not a file name,
+ ;; or if it happens to name a file that is a directory,
+ ;; convert it syntactically to a directory name.
+ ;; The reason for checking initially-was-dirname
+ ;; and not just file-directory-p
+ ;; is that file-directory-p is slow over ftp.
+ (if (or initially-was-dirname (file-directory-p dirname))
+ (setq dirname (file-name-as-directory dirname)))
(if (consp dir-or-list)
(setq dir-or-list (cons dirname (cdr dir-or-list)))
(setq dir-or-list dirname))