# HG changeset patch # User Kim F. Storm # Date 1072828812 0 # Node ID 4b85f31aef7cb7ba4dfbcd041088017771d1d221 # Parent 7922c045221bab2ec7f043c7e8b540446ef48e74 (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. diff -r 7922c045221b -r 4b85f31aef7c lisp/ido.el --- a/lisp/ido.el Tue Dec 30 23:59:39 2003 +0000 +++ b/lisp/ido.el Wed Dec 31 00:00:12 2003 +0000 @@ -1397,6 +1397,15 @@ (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 @@ (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 @@ (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 @@ (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))