# HG changeset patch # User Michael Albinus # Date 1191684350 0 # Node ID ef0a2673bf5e6b519fbbd57ba72393b040de4cb9 # Parent 235843a0d7081a2f80e32af020d041ed536175d8 * net/tramp.el (tramp-completion-mode): Extend doc-string. (tramp-completion-mode-p): Revert change from 2007-09-24. Checking for `return' etc as last character is not sufficient, for example in dired-mode when entering (revert-buffer) or (dired-sort). diff -r 235843a0d708 -r ef0a2673bf5e lisp/ChangeLog --- a/lisp/ChangeLog Sat Oct 06 10:19:45 2007 +0000 +++ b/lisp/ChangeLog Sat Oct 06 15:25:50 2007 +0000 @@ -1,3 +1,11 @@ +2007-10-06 Michael Albinus + + * net/tramp.el (tramp-completion-mode): Extend doc-string. + (tramp-completion-mode-p): Revert change from 2007-09-24. + Checking for `return' etc as last character is not sufficient, for + example in dired-mode when entering (revert-buffer) or + (dired-sort). + 2007-10-06 Martin Rudalics * window.el (mouse-autoselect-window-cancel): Don't cancel for diff -r 235843a0d708 -r ef0a2673bf5e lisp/net/tramp.el --- a/lisp/net/tramp.el Sat Oct 06 10:19:45 2007 +0000 +++ b/lisp/net/tramp.el Sat Oct 06 15:25:50 2007 +0000 @@ -4554,7 +4554,12 @@ ;;; File name handler functions for completion mode (defvar tramp-completion-mode nil - "If non-nil, we are in file name completion mode.") + "If non-nil, external packages signal that they are in file name completion. + +This is necessary, because Tramp uses a heuristic depending on last +input event. This fails when external packages use other characters +but , or ?\\? for file name completion. This variable +should never be set globally, the intention is to let-bind it.") ;; Necessary because `tramp-file-name-regexp-unified' and ;; `tramp-completion-file-name-regexp-unified' aren't different. @@ -4579,23 +4584,33 @@ file) (member (match-string 1 file) (mapcar 'car tramp-methods))) ((or - ;; Emacs - (not (memq last-input-event '(return newline))) + ;; Emacs. + (equal last-input-event 'tab) (and (natnump last-input-event) - (not (char-equal last-input-event ?\n)) - (not (char-equal last-input-event ?\r))) - ;; XEmacs + (or + ;; ?\t has event-modifier 'control + (char-equal last-input-event ?\t) + (and (not (event-modifiers last-input-event)) + (or (char-equal last-input-event ?\?) + (char-equal last-input-event ?\ ))))) + ;; XEmacs. (and (featurep 'xemacs) ;; `last-input-event' might be nil. (not (null last-input-event)) ;; `last-input-event' may have no character approximation. (funcall (symbol-function 'event-to-character) last-input-event) - (not (char-equal - (funcall (symbol-function 'event-to-character) - last-input-event) ?\n)) - (not (char-equal - (funcall (symbol-function 'event-to-character) - last-input-event) ?\r)))) + (or + ;; ?\t has event-modifier 'control + (char-equal + (funcall (symbol-function 'event-to-character) + last-input-event) ?\t) + (and (not (event-modifiers last-input-event)) + (or (char-equal + (funcall (symbol-function 'event-to-character) + last-input-event) ?\?) + (char-equal + (funcall (symbol-function 'event-to-character) + last-input-event) ?\ )))))) t))) ;; Method, host name and user name completion.