]> git.eshelyaron.com Git - emacs.git/commitdiff
* net/tramp.el (tramp-completion-mode): Extend doc-string.
authorMichael Albinus <michael.albinus@gmx.de>
Sat, 6 Oct 2007 15:25:50 +0000 (15:25 +0000)
committerMichael Albinus <michael.albinus@gmx.de>
Sat, 6 Oct 2007 15:25:50 +0000 (15:25 +0000)
(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 <g> (revert-buffer) or
<s> (dired-sort).

lisp/ChangeLog
lisp/net/tramp.el

index 80d5f3f7e4374d181311adab61f17df24f98079c..a30381b784cf0d2315e3a1af5ece792064a110fb 100644 (file)
@@ -1,3 +1,11 @@
+2007-10-06  Michael Albinus  <michael.albinus@gmx.de>
+
+       * 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 <g> (revert-buffer) or
+       <s> (dired-sort).
+
 2007-10-06  Martin Rudalics  <rudalics@gmx.at>
 
        * window.el (mouse-autoselect-window-cancel): Don't cancel for
index 7d2e5161ac9cd9c743877dd1125585eae984e88c..4bff0f8ee3fa57de2aa532a8678596ce6711c986 100644 (file)
@@ -4554,7 +4554,12 @@ Falls back to normal file name handler if no tramp file name handler exists."
 ;;; 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 <TAB>, <SPACE> 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 @@ Falls back to normal file name handler if no tramp file name handler exists."
      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.