Commit adfb6f1d authored by Michael Albinus's avatar Michael Albinus
Browse files

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)
parent 6220faeb
......@@ -2541,7 +2541,7 @@ If cursor is not at the end of the user input, move to end of input."
(defun ido-complete ()
"Try and complete the current pattern amongst the file names."
(interactive)
(let (res)
(let (non-essential res)
(cond
(ido-incomplete-regexp
;; Do nothing
......@@ -3556,7 +3556,6 @@ it is put to the start of the list."
;; Strip method:user@host: part of tramp completions.
;; Tramp completions do not include leading slash.
(let* ((len (1- (length dir)))
(non-essential t)
(compl
(or ;; We do not want to be disturbed by "File does not
;; exist" errors.
......
......@@ -2137,7 +2137,7 @@ preventing reentrant calls of Tramp.")
;; non-nil, we must load tramp.el, in order to get the real definition
;; of `tramp-completion-file-name-handler'.
;;;###autoload(defun tramp-completion-file-name-handler (operation &rest args)
;;;###autoload (if (and (boundp 'non-essential) (symbol-value 'non-essential))
;;;###autoload (if (tramp-completion-mode-p)
;;;###autoload (apply 'tramp-autoload-file-name-handler operation args)
;;;###autoload (tramp-completion-run-real-handler operation args)))
......@@ -2145,23 +2145,7 @@ preventing reentrant calls of Tramp.")
"Invoke Tramp file name completion handler.
Falls back to normal file name handler if no Tramp file name handler exists."
(let ((fn (assoc operation tramp-completion-file-name-handler-alist)))
(if (and
;; When `tramp-mode' is not enabled, we don't do anything.
fn tramp-mode (tramp-completion-mode-p)
;; For other syntaxes than `sep', the regexp matches many common
;; situations where the user doesn't actually want to use Tramp.
;; So to avoid autoloading Tramp after typing just "/s", we
;; disable this part of the completion, unless the user implicitly
;; indicated his interest in using a fancier completion system.
(or (eq tramp-syntax 'sep)
(featurep 'tramp) ;; If it's loaded, we may as well use it.
;; `partial-completion-mode' is obsoleted with Emacs 24.1.
(and (boundp 'partial-completion-mode)
(symbol-value 'partial-completion-mode))
;; FIXME: These may have been loaded even if the user never
;; intended to use them.
(featurep 'ido)
(featurep 'icicles)))
(if (and fn tramp-mode (tramp-completion-mode-p))
(save-match-data (apply (cdr fn) args))
(tramp-completion-run-real-handler operation args))))
......@@ -2281,20 +2265,13 @@ should never be set globally, the intention is to let-bind it.")
;; Tramp file name syntax. Maybe another variable should be introduced
;; overwriting this check in such cases. Or we change Tramp file name
;; syntax in order to avoid ambiguities.
(defun tramp-completion-mode-p ()
;;;###autoload
(progn (defun tramp-completion-mode-p ()
"Check, whether method / user name / host name completion is active."
(or
;; Signal from outside. `non-essential' has been introduced in Emacs 24.
(and (boundp 'non-essential) (symbol-value 'non-essential))
tramp-completion-mode
(equal last-input-event 'tab)
(and (natnump last-input-event)
(or
;; ?\t has event-modifier 'control.
(equal last-input-event ?\t)
(and (not (event-modifiers last-input-event))
(or (equal last-input-event ?\?)
(equal last-input-event ?\ )))))))
tramp-completion-mode)))
(defun tramp-connectable-p (filename)
"Check, whether it is possible to connect the remote host w/o side-effects.
......@@ -2309,17 +2286,12 @@ not in completion mode."
(defun tramp-completion-handle-expand-file-name (name &optional dir)
"Like `expand-file-name' for Tramp files."
(if (tramp-completion-mode-p)
(progn
;; If DIR is not given, use `default-directory' or "/".
(setq dir (or dir default-directory "/"))
(cond
((file-name-absolute-p name) name)
((zerop (length name)) dir)
(t (concat (file-name-as-directory dir) name))))
(tramp-completion-run-real-handler
'expand-file-name (list name dir))))
;; If DIR is not given, use `default-directory' or "/".
(setq dir (or dir default-directory "/"))
(cond
((file-name-absolute-p name) name)
((zerop (length name)) dir)
(t (concat (file-name-as-directory dir) name))))
;; Method, host name and user name completion.
;; `tramp-completion-dissect-file-name' returns a list of
......@@ -2406,11 +2378,11 @@ not in completion mode."
(tramp-connectable-p (expand-file-name filename directory)))
(lambda (x) (funcall predicate (expand-file-name (car x) directory))))))
;; I misuse a little bit the tramp-file-name structure in order to handle
;; completion possibilities for partial methods / user names / host names.
;; Return value is a list of tramp-file-name structures according to possible
;; completions. If "localname" is non-nil it means there
;; shouldn't be a completion anymore.
;; I misuse a little bit the tramp-file-name structure in order to
;; handle completion possibilities for partial methods / user names /
;; host names. Return value is a list of tramp-file-name structures
;; according to possible completions. If "localname" is non-nil it
;; means there shouldn't be a completion anymore.
;; Expected results:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment