summaryrefslogtreecommitdiff
path: root/lisp/ido.el
diff options
context:
space:
mode:
authorKim F. Storm <storm@cua.dk>2003-12-31 00:00:12 +0000
committerKim F. Storm <storm@cua.dk>2003-12-31 00:00:12 +0000
commit866f22396f97c755274bc5f81c68789337d05531 (patch)
tree96ff055e6819bba0a7c43e828fa881609b69bbb5 /lisp/ido.el
parent407d1e61ac3a51279ab80b963d7a238827b0e4da (diff)
downloademacs-866f22396f97c755274bc5f81c68789337d05531.tar.gz
emacs-866f22396f97c755274bc5f81c68789337d05531.tar.bz2
emacs-866f22396f97c755274bc5f81c68789337d05531.zip
(ido-nonreadable-directory-p): New defun to check for
nonreadable directory without activating tramp to avoid problems with checking incomplete tramp paths. (ido-set-current-directory, ido-file-internal) (ido-file-name-all-completions1): Use it.
Diffstat (limited to 'lisp/ido.el')
-rw-r--r--lisp/ido.el15
1 files changed, 12 insertions, 3 deletions
diff --git a/lisp/ido.el b/lisp/ido.el
index 165142ea222..4593c55dff7 100644
--- a/lisp/ido.el
+++ b/lisp/ido.el
@@ -1397,6 +1397,15 @@ This function also adds a hook to the minibuffer."
(substring s 0 l)
s)))
+(defun ido-nonreadable-directory-p (dir)
+ ;; Return t if dir is a directory, but not readable
+ ;; Do not check for non-readable directories via tramp, as this causes a premature
+ ;; connect on incomplete tramp paths (after entring just method:).
+ (let ((ido-enable-tramp-completion nil))
+ (and (ido-final-slash dir)
+ (file-directory-p dir)
+ (not (file-readable-p dir)))))
+
(defun ido-set-current-directory (dir &optional subdir no-merge)
;; Set ido's current directory to DIR or DIR/SUBDIR
(setq dir (ido-final-slash dir t))
@@ -1410,7 +1419,7 @@ This function also adds a hook to the minibuffer."
(setq ido-current-directory dir)
(if (get-buffer ido-completion-buffer)
(kill-buffer ido-completion-buffer))
- (setq ido-directory-nonreadable (not (file-readable-p dir)))
+ (setq ido-directory-nonreadable (ido-nonreadable-directory-p dir))
t))
(defun ido-set-current-home (&optional dir)
@@ -1867,7 +1876,7 @@ If INITIAL is non-nil, it specifies the initial input string."
(unless item
(setq item 'file))
(let* ((ido-current-directory (ido-expand-directory default))
- (ido-directory-nonreadable (not (file-readable-p ido-current-directory)))
+ (ido-directory-nonreadable (ido-nonreadable-directory-p ido-current-directory))
filename)
(cond
@@ -2706,7 +2715,7 @@ for first matching file."
(defun ido-file-name-all-completions1 (dir)
(cond
- ((not (file-readable-p dir)) '())
+ ((ido-nonreadable-directory-p dir) '())
((and ido-enable-tramp-completion
(string-match "\\`/\\([^/:]+:\\([^/:@]+@\\)?\\)\\'" dir))