changeset 78997:ef0a2673bf5e

* 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).
author Michael Albinus <michael.albinus@gmx.de>
date Sat, 06 Oct 2007 15:25:50 +0000
parents 235843a0d708
children a3e0c8a124d4
files lisp/ChangeLog lisp/net/tramp.el
diffstat 2 files changed, 35 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
--- 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  <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
--- 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 <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 @@
      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.