summaryrefslogtreecommitdiff
path: root/lisp/ido.el
diff options
context:
space:
mode:
authorKim F. Storm <storm@cua.dk>2006-11-30 20:50:31 +0000
committerKim F. Storm <storm@cua.dk>2006-11-30 20:50:31 +0000
commit10b19e8897234fe0d51245bbbe3048c548568a3e (patch)
tree68fabb0aa90831fa9d3ab4d12b9cb12fea388b2c /lisp/ido.el
parent939cb3e8716d678ff8cb51f81189e6b0e9e0c37c (diff)
downloademacs-10b19e8897234fe0d51245bbbe3048c548568a3e.tar.gz
2006-11-30 Michaƫl Cadilhac <michael.cadilhac@lrde.org>
(ido-local-file-exists-p): New. Tell if a file exists locally, i.e. without using file name handlers. (ido-read-internal): Allow mono letter host names, avoiding the `c:' problem by testing if the file exists locally. (ido-complete, ido-make-file-list, ido-exhibit): Ditto.
Diffstat (limited to 'lisp/ido.el')
-rw-r--r--lisp/ido.el26
1 files changed, 18 insertions, 8 deletions
diff --git a/lisp/ido.el b/lisp/ido.el
index 8844b12f5b7..0e18c4b5fde 100644
--- a/lisp/ido.el
+++ b/lisp/ido.el
@@ -1142,6 +1142,11 @@ so that it doesn't interfere with other minibuffer usage.")
(pop-to-buffer b t t)
(setq truncate-lines t)))))
+(defun ido-local-file-exists-p (file)
+ "Tell if FILE exists locally."
+ (let (file-name-handler-alist)
+ (file-exists-p file)))
+
(defun ido-unc-hosts (&optional query)
"Return list of UNC host names."
(let ((hosts
@@ -2068,8 +2073,9 @@ If INITIAL is non-nil, it specifies the initial input string."
(ido-set-current-directory (file-name-directory (substring ido-current-directory 0 -1))))
(setq ido-set-default-item t))
- ((and (string-match (if ido-enable-tramp-completion "..[:@]\\'" "..:\\'") ido-selected)
- (ido-is-root-directory)) ;; Ange-ftp or Tramp
+ ((and (string-match (if ido-enable-tramp-completion ".[:@]\\'" ".:\\'") ido-selected)
+ (ido-is-root-directory) ;; Ange-ftp or Tramp
+ (not (ido-local-file-exists-p ido-selected)))
(ido-set-current-directory ido-current-directory ido-selected)
(ido-trace "tramp prefix" ido-selected)
(if (ido-is-slow-ftp-host)
@@ -2079,7 +2085,7 @@ If INITIAL is non-nil, it specifies the initial input string."
((or (string-match "[/\\][^/\\]" ido-selected)
(and (memq system-type '(windows-nt ms-dos))
- (string-match "\\`.:" ido-selected)))
+ (string-match "\\`[a-zA-Z]:" ido-selected)))
(ido-set-current-directory (file-name-directory ido-selected))
(setq ido-set-default-item t))
@@ -2428,7 +2434,8 @@ If INITIAL is non-nil, it specifies the initial input string."
((and (= 1 (length ido-matches))
(not (and ido-enable-tramp-completion
(string-equal ido-current-directory "/")
- (string-match "..[@:]\\'" (ido-name (car ido-matches))))))
+ (string-match ".[@:]\\'" (ido-name (car ido-matches)))))
+ (not (ido-local-file-exists-p (ido-name (car ido-matches)))))
;; only one choice, so select it.
(if (not ido-confirm-unique-completion)
(exit-minibuffer)
@@ -3438,9 +3445,11 @@ for first matching file."
(let ((default-directory ido-current-directory))
(ido-to-end ;; move ftp hosts and visited files to end
(delq nil (mapcar
- (lambda (x) (if (or (string-match "..:\\'" x)
+ (lambda (x) (if (or (and (string-match ".:\\'" x)
+ (not (ido-local-file-exists-p x)))
(and (not (ido-final-slash x))
- (get-file-buffer x))) x))
+ (let (file-name-handler-alist)
+ (get-file-buffer x)))) x))
ido-temp-list)))))
(ido-to-end ;; move . files to end
(delq nil (mapcar
@@ -4154,8 +4163,9 @@ For details of keybindings, do `\\[describe-function] ido-find-file'."
(setq refresh t))
))
- ((and (string-match (if ido-enable-tramp-completion "..[:@]\\'" "..:\\'") contents)
- (ido-is-root-directory)) ;; Ange-ftp or tramp
+ ((and (string-match (if ido-enable-tramp-completion ".[:@]\\'" ".:\\'") contents)
+ (ido-is-root-directory) ;; Ange-ftp or tramp
+ (not (ido-local-file-exists-p contents)))
(ido-set-current-directory ido-current-directory contents)
(when (ido-is-slow-ftp-host)
(setq ido-exit 'fallback)