diff options
| author | Michael Albinus | 2017-02-15 19:42:34 +0100 |
|---|---|---|
| committer | Michael Albinus | 2017-02-15 19:42:34 +0100 |
| commit | adfb6f1dc26a927cf4bab24bdfae54b51e3ae0ec (patch) | |
| tree | 739d83cd439a34ab7745970d6f6e16cb52f931f2 | |
| parent | 6220faeb4e9be16b9dec728e72ea8dff2cfe35ba (diff) | |
| download | emacs-adfb6f1dc26a927cf4bab24bdfae54b51e3ae0ec.tar.gz emacs-adfb6f1dc26a927cf4bab24bdfae54b51e3ae0ec.zip | |
Continue to fix bug#25607
* lisp/ido.el (ido-complete): Let-bind `non-essential' to nil.
(ido-file-name-all-completions-1): Do not bind `non-essential'.
* lisp/net/tramp.el: (tramp-completion-file-name-handler):
Improve autoloaded version.
(tramp-completion-file-name-handler): Remove old compat code.
Check only for `tramp-completion-mode-p'.
(tramp-completion-mode-p): Autoload. Do not check any longer
for `last-input-event'.
(tramp-completion-handle-expand-file-name): Simplify. (Bug#25607)
| -rw-r--r-- | lisp/ido.el | 3 | ||||
| -rw-r--r-- | lisp/net/tramp.el | 60 |
2 files changed, 17 insertions, 46 deletions
diff --git a/lisp/ido.el b/lisp/ido.el index e18464d1d6b..561d6e7f081 100644 --- a/lisp/ido.el +++ b/lisp/ido.el | |||
| @@ -2541,7 +2541,7 @@ If cursor is not at the end of the user input, move to end of input." | |||
| 2541 | (defun ido-complete () | 2541 | (defun ido-complete () |
| 2542 | "Try and complete the current pattern amongst the file names." | 2542 | "Try and complete the current pattern amongst the file names." |
| 2543 | (interactive) | 2543 | (interactive) |
| 2544 | (let (res) | 2544 | (let (non-essential res) |
| 2545 | (cond | 2545 | (cond |
| 2546 | (ido-incomplete-regexp | 2546 | (ido-incomplete-regexp |
| 2547 | ;; Do nothing | 2547 | ;; Do nothing |
| @@ -3556,7 +3556,6 @@ it is put to the start of the list." | |||
| 3556 | ;; Strip method:user@host: part of tramp completions. | 3556 | ;; Strip method:user@host: part of tramp completions. |
| 3557 | ;; Tramp completions do not include leading slash. | 3557 | ;; Tramp completions do not include leading slash. |
| 3558 | (let* ((len (1- (length dir))) | 3558 | (let* ((len (1- (length dir))) |
| 3559 | (non-essential t) | ||
| 3560 | (compl | 3559 | (compl |
| 3561 | (or ;; We do not want to be disturbed by "File does not | 3560 | (or ;; We do not want to be disturbed by "File does not |
| 3562 | ;; exist" errors. | 3561 | ;; exist" errors. |
diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el index 4b5bd472632..c0f6fdcfadc 100644 --- a/lisp/net/tramp.el +++ b/lisp/net/tramp.el | |||
| @@ -2137,7 +2137,7 @@ preventing reentrant calls of Tramp.") | |||
| 2137 | ;; non-nil, we must load tramp.el, in order to get the real definition | 2137 | ;; non-nil, we must load tramp.el, in order to get the real definition |
| 2138 | ;; of `tramp-completion-file-name-handler'. | 2138 | ;; of `tramp-completion-file-name-handler'. |
| 2139 | ;;;###autoload(defun tramp-completion-file-name-handler (operation &rest args) | 2139 | ;;;###autoload(defun tramp-completion-file-name-handler (operation &rest args) |
| 2140 | ;;;###autoload (if (and (boundp 'non-essential) (symbol-value 'non-essential)) | 2140 | ;;;###autoload (if (tramp-completion-mode-p) |
| 2141 | ;;;###autoload (apply 'tramp-autoload-file-name-handler operation args) | 2141 | ;;;###autoload (apply 'tramp-autoload-file-name-handler operation args) |
| 2142 | ;;;###autoload (tramp-completion-run-real-handler operation args))) | 2142 | ;;;###autoload (tramp-completion-run-real-handler operation args))) |
| 2143 | 2143 | ||
| @@ -2145,23 +2145,7 @@ preventing reentrant calls of Tramp.") | |||
| 2145 | "Invoke Tramp file name completion handler. | 2145 | "Invoke Tramp file name completion handler. |
| 2146 | Falls back to normal file name handler if no Tramp file name handler exists." | 2146 | Falls back to normal file name handler if no Tramp file name handler exists." |
| 2147 | (let ((fn (assoc operation tramp-completion-file-name-handler-alist))) | 2147 | (let ((fn (assoc operation tramp-completion-file-name-handler-alist))) |
| 2148 | (if (and | 2148 | (if (and fn tramp-mode (tramp-completion-mode-p)) |
| 2149 | ;; When `tramp-mode' is not enabled, we don't do anything. | ||
| 2150 | fn tramp-mode (tramp-completion-mode-p) | ||
| 2151 | ;; For other syntaxes than `sep', the regexp matches many common | ||
| 2152 | ;; situations where the user doesn't actually want to use Tramp. | ||
| 2153 | ;; So to avoid autoloading Tramp after typing just "/s", we | ||
| 2154 | ;; disable this part of the completion, unless the user implicitly | ||
| 2155 | ;; indicated his interest in using a fancier completion system. | ||
| 2156 | (or (eq tramp-syntax 'sep) | ||
| 2157 | (featurep 'tramp) ;; If it's loaded, we may as well use it. | ||
| 2158 | ;; `partial-completion-mode' is obsoleted with Emacs 24.1. | ||
| 2159 | (and (boundp 'partial-completion-mode) | ||
| 2160 | (symbol-value 'partial-completion-mode)) | ||
| 2161 | ;; FIXME: These may have been loaded even if the user never | ||
| 2162 | ;; intended to use them. | ||
| 2163 | (featurep 'ido) | ||
| 2164 | (featurep 'icicles))) | ||
| 2165 | (save-match-data (apply (cdr fn) args)) | 2149 | (save-match-data (apply (cdr fn) args)) |
| 2166 | (tramp-completion-run-real-handler operation args)))) | 2150 | (tramp-completion-run-real-handler operation args)))) |
| 2167 | 2151 | ||
| @@ -2281,20 +2265,13 @@ should never be set globally, the intention is to let-bind it.") | |||
| 2281 | ;; Tramp file name syntax. Maybe another variable should be introduced | 2265 | ;; Tramp file name syntax. Maybe another variable should be introduced |
| 2282 | ;; overwriting this check in such cases. Or we change Tramp file name | 2266 | ;; overwriting this check in such cases. Or we change Tramp file name |
| 2283 | ;; syntax in order to avoid ambiguities. | 2267 | ;; syntax in order to avoid ambiguities. |
| 2284 | (defun tramp-completion-mode-p () | 2268 | ;;;###autoload |
| 2269 | (progn (defun tramp-completion-mode-p () | ||
| 2285 | "Check, whether method / user name / host name completion is active." | 2270 | "Check, whether method / user name / host name completion is active." |
| 2286 | (or | 2271 | (or |
| 2287 | ;; Signal from outside. `non-essential' has been introduced in Emacs 24. | 2272 | ;; Signal from outside. `non-essential' has been introduced in Emacs 24. |
| 2288 | (and (boundp 'non-essential) (symbol-value 'non-essential)) | 2273 | (and (boundp 'non-essential) (symbol-value 'non-essential)) |
| 2289 | tramp-completion-mode | 2274 | tramp-completion-mode))) |
| 2290 | (equal last-input-event 'tab) | ||
| 2291 | (and (natnump last-input-event) | ||
| 2292 | (or | ||
| 2293 | ;; ?\t has event-modifier 'control. | ||
| 2294 | (equal last-input-event ?\t) | ||
| 2295 | (and (not (event-modifiers last-input-event)) | ||
| 2296 | (or (equal last-input-event ?\?) | ||
| 2297 | (equal last-input-event ?\ ))))))) | ||
| 2298 | 2275 | ||
| 2299 | (defun tramp-connectable-p (filename) | 2276 | (defun tramp-connectable-p (filename) |
| 2300 | "Check, whether it is possible to connect the remote host w/o side-effects. | 2277 | "Check, whether it is possible to connect the remote host w/o side-effects. |
| @@ -2309,17 +2286,12 @@ not in completion mode." | |||
| 2309 | 2286 | ||
| 2310 | (defun tramp-completion-handle-expand-file-name (name &optional dir) | 2287 | (defun tramp-completion-handle-expand-file-name (name &optional dir) |
| 2311 | "Like `expand-file-name' for Tramp files." | 2288 | "Like `expand-file-name' for Tramp files." |
| 2312 | (if (tramp-completion-mode-p) | 2289 | ;; If DIR is not given, use `default-directory' or "/". |
| 2313 | (progn | 2290 | (setq dir (or dir default-directory "/")) |
| 2314 | ;; If DIR is not given, use `default-directory' or "/". | 2291 | (cond |
| 2315 | (setq dir (or dir default-directory "/")) | 2292 | ((file-name-absolute-p name) name) |
| 2316 | (cond | 2293 | ((zerop (length name)) dir) |
| 2317 | ((file-name-absolute-p name) name) | 2294 | (t (concat (file-name-as-directory dir) name)))) |
| 2318 | ((zerop (length name)) dir) | ||
| 2319 | (t (concat (file-name-as-directory dir) name)))) | ||
| 2320 | |||
| 2321 | (tramp-completion-run-real-handler | ||
| 2322 | 'expand-file-name (list name dir)))) | ||
| 2323 | 2295 | ||
| 2324 | ;; Method, host name and user name completion. | 2296 | ;; Method, host name and user name completion. |
| 2325 | ;; `tramp-completion-dissect-file-name' returns a list of | 2297 | ;; `tramp-completion-dissect-file-name' returns a list of |
| @@ -2406,11 +2378,11 @@ not in completion mode." | |||
| 2406 | (tramp-connectable-p (expand-file-name filename directory))) | 2378 | (tramp-connectable-p (expand-file-name filename directory))) |
| 2407 | (lambda (x) (funcall predicate (expand-file-name (car x) directory)))))) | 2379 | (lambda (x) (funcall predicate (expand-file-name (car x) directory)))))) |
| 2408 | 2380 | ||
| 2409 | ;; I misuse a little bit the tramp-file-name structure in order to handle | 2381 | ;; I misuse a little bit the tramp-file-name structure in order to |
| 2410 | ;; completion possibilities for partial methods / user names / host names. | 2382 | ;; handle completion possibilities for partial methods / user names / |
| 2411 | ;; Return value is a list of tramp-file-name structures according to possible | 2383 | ;; host names. Return value is a list of tramp-file-name structures |
| 2412 | ;; completions. If "localname" is non-nil it means there | 2384 | ;; according to possible completions. If "localname" is non-nil it |
| 2413 | ;; shouldn't be a completion anymore. | 2385 | ;; means there shouldn't be a completion anymore. |
| 2414 | 2386 | ||
| 2415 | ;; Expected results: | 2387 | ;; Expected results: |
| 2416 | 2388 | ||