changeset 78887:8faf94b6c420

* net/tramp.el (tramp-completion-mode-p): Rename from `tramp-completion-mode'. Revert logic, check `return', `newline' and such alike. Packages like Icicles tend to use other completion characters but `tab' and `space' only. (top): Require cl.el, when `copy-tree' is not available otherwise. * net/tramp-vc.el (tramp-vc-user-login-name): Get argument by `ad-get-arg'. Use `vc-find-version' instead of `process-file' to check whether we have a new enough vc that doesn't need the defadvice.
author Michael Albinus <michael.albinus@gmx.de>
date Mon, 24 Sep 2007 05:42:34 +0000
parents da3f83794d1f
children 0e65a91a8bf7
files lisp/ChangeLog lisp/net/tramp-vc.el lisp/net/tramp.el
diffstat 3 files changed, 52 insertions(+), 36 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/ChangeLog	Sun Sep 23 16:01:40 2007 +0000
+++ b/lisp/ChangeLog	Mon Sep 24 05:42:34 2007 +0000
@@ -1,3 +1,20 @@
+2007-09-24  Michael Albinus  <michael.albinus@gmx.de>
+
+	* net/tramp.el (tramp-completion-mode-p): Rename from
+	`tramp-completion-mode'. Revert logic, check `return', `newline'
+	and such alike. Packages like Icicles tend to use other completion
+	characters but `tab' and `space' only.
+	(top): Require cl.el, when `copy-tree' is not available otherwise.
+
+	* net/tramp-vc.el (tramp-vc-user-login-name): Get argument by
+	`ad-get-arg'.
+
+2007-09-24  Ville Skyttä  <scop@xemacs.org>  (tiny change)
+
+	* net/tramp-vc.el (tramp-vc-user-login-name): Use
+	`vc-find-version' instead of `process-file' to check whether we
+	have a new enough vc that doesn't need the defadvice.
+
 2007-09-23  Dan Nicolaescu  <dann@ics.uci.edu>
 
 	* files.el (file-name-sans-versions): Use [:alnum:] and also allow
--- a/lisp/net/tramp-vc.el	Sun Sep 23 16:01:40 2007 +0000
+++ b/lisp/net/tramp-vc.el	Mon Sep 24 05:42:34 2007 +0000
@@ -437,7 +437,10 @@
 ;; The following defadvice is no longer necessary after changes in VC
 ;; on 2006-01-25, Andre.
 
-(unless (fboundp 'process-file)
+;; That means either GNU Emacs >= 22 or the "new vc" package from XEmacs
+;; packages collection; as of 2007-09-06, test for availability of
+;; `vc-find-version' works for both of those cases.
+(unless (fboundp 'vc-find-version)
   (defadvice vc-user-login-name
     (around tramp-vc-user-login-name activate)
     "Support for files on remote machines accessed by TRAMP."
@@ -453,7 +456,7 @@
 	       (tramp-tramp-file-p file)	; tramp file
 	       (setq ad-return-value
 		     (save-match-data
-		       (tramp-handle-vc-user-login-name uid)))) ; get the owner name
+		       (tramp-handle-vc-user-login-name (ad-get-arg 0))))) ; get the owner name
 	  ad-do-it)))                     ; else call the original
 
   (add-hook 'tramp-unload-hook
--- a/lisp/net/tramp.el	Sun Sep 23 16:01:40 2007 +0000
+++ b/lisp/net/tramp.el	Mon Sep 24 05:42:34 2007 +0000
@@ -94,6 +94,11 @@
 (require 'shell)
 (require 'advice)
 
+;; `copy-tree' is part of subr.el since Emacs 22.
+(eval-when-compile
+  (unless (functionp 'copy-tree)
+    (require 'cl)))
+
 (autoload 'tramp-uuencode-region "tramp-uu"
   "Implementation of `uuencode' in Lisp.")
 (add-hook 'tramp-unload-hook
@@ -4239,10 +4244,10 @@
 	 (inhibit-file-name-operation operation))
     (apply operation args))))
 
-;; This function is used from `tramp-completion-file-name-handler' functions
-;; only, if `tramp-completion-mode' is true. But this cannot be checked here
-;; because the check is based on a full filename, not available for all
-;; basic I/O operations.
+;; This function is used from `tramp-completion-file-name-handler'
+;; functions only, if `tramp-completion-mode-p' is true. But this
+;; cannot be checked here because the check is based on a full
+;; filename, not available for all basic I/O operations.
 ;;;###autoload
 (progn (defun tramp-completion-run-real-handler (operation args)
   "Invoke `tramp-file-name-handler' for OPERATION.
@@ -4357,7 +4362,7 @@
 ;;  (edebug-trace "%s" (with-output-to-string (backtrace)))
   (save-match-data
     (let* ((filename (apply 'tramp-file-name-for-operation operation args))
-	   (completion (tramp-completion-mode filename))
+	   (completion (tramp-completion-mode-p filename))
 	   (foreign (tramp-find-foreign-file-name-handler filename)))
       (with-parsed-tramp-file-name filename nil
 	(cond
@@ -4563,7 +4568,7 @@
 ;; file name syntax in order to avoid ambiguities, like in XEmacs ...
 ;; In case of non unified file names it can be always true (and wouldn't be
 ;; necessary, because there are different regexp).
-(defun tramp-completion-mode (file)
+(defun tramp-completion-mode-p (file)
   "Checks whether method / user name / host name completion is active."
   (cond
    (tramp-completion-mode t)
@@ -4573,33 +4578,24 @@
       "\\(" tramp-method-regexp  "\\)" tramp-postfix-single-method-regexp "$")
      file)
     (member (match-string 1 file) (mapcar 'car tramp-methods)))
-   ((or (equal last-input-event 'tab)
-  	;; Emacs
-  	(and (natnump last-input-event)
-	     (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)
-	     (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) ?\ ))))))
+   ((or
+     ;; Emacs
+     (not (memq last-input-event '(return newline)))
+     (and (natnump last-input-event)
+	  (not (char-equal last-input-event ?\n))
+	  (not (char-equal last-input-event ?\r)))
+     ;; 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))))
     t)))
 
 ;; Method, host name and user name completion.
@@ -7898,7 +7894,7 @@
 ;; ** If `partial-completion-mode' isn't loaded, "/foo:bla" tries to
 ;;    connect to host "blabla" already if that host is unique. No idea
 ;;    how to suppress. Maybe not an essential problem.
-;; ** Try to avoid usage of `last-input-event' in `tramp-completion-mode'.
+;; ** Try to avoid usage of `last-input-event' in `tramp-completion-mode-p'.
 ;; ** Extend `tramp-get-completion-su' for NIS and shadow passwords.
 ;; ** Unify `tramp-parse-{rhosts,shosts,sconfig,hosts,passwd,netrc}'.
 ;;    Code is nearly identical.