diff options
| author | Kim F. Storm | 2006-11-30 20:50:31 +0000 |
|---|---|---|
| committer | Kim F. Storm | 2006-11-30 20:50:31 +0000 |
| commit | 10b19e8897234fe0d51245bbbe3048c548568a3e (patch) | |
| tree | 68fabb0aa90831fa9d3ab4d12b9cb12fea388b2c | |
| parent | 939cb3e8716d678ff8cb51f81189e6b0e9e0c37c (diff) | |
| download | emacs-10b19e8897234fe0d51245bbbe3048c548568a3e.tar.gz emacs-10b19e8897234fe0d51245bbbe3048c548568a3e.zip | |
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.
| -rw-r--r-- | lisp/ido.el | 26 |
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.") | |||
| 1142 | (pop-to-buffer b t t) | 1142 | (pop-to-buffer b t t) |
| 1143 | (setq truncate-lines t))))) | 1143 | (setq truncate-lines t))))) |
| 1144 | 1144 | ||
| 1145 | (defun ido-local-file-exists-p (file) | ||
| 1146 | "Tell if FILE exists locally." | ||
| 1147 | (let (file-name-handler-alist) | ||
| 1148 | (file-exists-p file))) | ||
| 1149 | |||
| 1145 | (defun ido-unc-hosts (&optional query) | 1150 | (defun ido-unc-hosts (&optional query) |
| 1146 | "Return list of UNC host names." | 1151 | "Return list of UNC host names." |
| 1147 | (let ((hosts | 1152 | (let ((hosts |
| @@ -2068,8 +2073,9 @@ If INITIAL is non-nil, it specifies the initial input string." | |||
| 2068 | (ido-set-current-directory (file-name-directory (substring ido-current-directory 0 -1)))) | 2073 | (ido-set-current-directory (file-name-directory (substring ido-current-directory 0 -1)))) |
| 2069 | (setq ido-set-default-item t)) | 2074 | (setq ido-set-default-item t)) |
| 2070 | 2075 | ||
| 2071 | ((and (string-match (if ido-enable-tramp-completion "..[:@]\\'" "..:\\'") ido-selected) | 2076 | ((and (string-match (if ido-enable-tramp-completion ".[:@]\\'" ".:\\'") ido-selected) |
| 2072 | (ido-is-root-directory)) ;; Ange-ftp or Tramp | 2077 | (ido-is-root-directory) ;; Ange-ftp or Tramp |
| 2078 | (not (ido-local-file-exists-p ido-selected))) | ||
| 2073 | (ido-set-current-directory ido-current-directory ido-selected) | 2079 | (ido-set-current-directory ido-current-directory ido-selected) |
| 2074 | (ido-trace "tramp prefix" ido-selected) | 2080 | (ido-trace "tramp prefix" ido-selected) |
| 2075 | (if (ido-is-slow-ftp-host) | 2081 | (if (ido-is-slow-ftp-host) |
| @@ -2079,7 +2085,7 @@ If INITIAL is non-nil, it specifies the initial input string." | |||
| 2079 | 2085 | ||
| 2080 | ((or (string-match "[/\\][^/\\]" ido-selected) | 2086 | ((or (string-match "[/\\][^/\\]" ido-selected) |
| 2081 | (and (memq system-type '(windows-nt ms-dos)) | 2087 | (and (memq system-type '(windows-nt ms-dos)) |
| 2082 | (string-match "\\`.:" ido-selected))) | 2088 | (string-match "\\`[a-zA-Z]:" ido-selected))) |
| 2083 | (ido-set-current-directory (file-name-directory ido-selected)) | 2089 | (ido-set-current-directory (file-name-directory ido-selected)) |
| 2084 | (setq ido-set-default-item t)) | 2090 | (setq ido-set-default-item t)) |
| 2085 | 2091 | ||
| @@ -2428,7 +2434,8 @@ If INITIAL is non-nil, it specifies the initial input string." | |||
| 2428 | ((and (= 1 (length ido-matches)) | 2434 | ((and (= 1 (length ido-matches)) |
| 2429 | (not (and ido-enable-tramp-completion | 2435 | (not (and ido-enable-tramp-completion |
| 2430 | (string-equal ido-current-directory "/") | 2436 | (string-equal ido-current-directory "/") |
| 2431 | (string-match "..[@:]\\'" (ido-name (car ido-matches)))))) | 2437 | (string-match ".[@:]\\'" (ido-name (car ido-matches))))) |
| 2438 | (not (ido-local-file-exists-p (ido-name (car ido-matches))))) | ||
| 2432 | ;; only one choice, so select it. | 2439 | ;; only one choice, so select it. |
| 2433 | (if (not ido-confirm-unique-completion) | 2440 | (if (not ido-confirm-unique-completion) |
| 2434 | (exit-minibuffer) | 2441 | (exit-minibuffer) |
| @@ -3438,9 +3445,11 @@ for first matching file." | |||
| 3438 | (let ((default-directory ido-current-directory)) | 3445 | (let ((default-directory ido-current-directory)) |
| 3439 | (ido-to-end ;; move ftp hosts and visited files to end | 3446 | (ido-to-end ;; move ftp hosts and visited files to end |
| 3440 | (delq nil (mapcar | 3447 | (delq nil (mapcar |
| 3441 | (lambda (x) (if (or (string-match "..:\\'" x) | 3448 | (lambda (x) (if (or (and (string-match ".:\\'" x) |
| 3449 | (not (ido-local-file-exists-p x))) | ||
| 3442 | (and (not (ido-final-slash x)) | 3450 | (and (not (ido-final-slash x)) |
| 3443 | (get-file-buffer x))) x)) | 3451 | (let (file-name-handler-alist) |
| 3452 | (get-file-buffer x)))) x)) | ||
| 3444 | ido-temp-list))))) | 3453 | ido-temp-list))))) |
| 3445 | (ido-to-end ;; move . files to end | 3454 | (ido-to-end ;; move . files to end |
| 3446 | (delq nil (mapcar | 3455 | (delq nil (mapcar |
| @@ -4154,8 +4163,9 @@ For details of keybindings, do `\\[describe-function] ido-find-file'." | |||
| 4154 | (setq refresh t)) | 4163 | (setq refresh t)) |
| 4155 | )) | 4164 | )) |
| 4156 | 4165 | ||
| 4157 | ((and (string-match (if ido-enable-tramp-completion "..[:@]\\'" "..:\\'") contents) | 4166 | ((and (string-match (if ido-enable-tramp-completion ".[:@]\\'" ".:\\'") contents) |
| 4158 | (ido-is-root-directory)) ;; Ange-ftp or tramp | 4167 | (ido-is-root-directory) ;; Ange-ftp or tramp |
| 4168 | (not (ido-local-file-exists-p contents))) | ||
| 4159 | (ido-set-current-directory ido-current-directory contents) | 4169 | (ido-set-current-directory ido-current-directory contents) |
| 4160 | (when (ido-is-slow-ftp-host) | 4170 | (when (ido-is-slow-ftp-host) |
| 4161 | (setq ido-exit 'fallback) | 4171 | (setq ido-exit 'fallback) |