changeset 111788:8e746f396237

* net/tramp.el (tramp-local-host-regexp): Add "localhost6". (tramp-file-name-port): Check also for `tramp-default-port'. (tramp-get-connection-name): New defun. (tramp-get-connection-process): Use it. (tramp-debug-message): Extend function exclude list. (tramp-drop-volume-letter): Fix doc string. * net/tramp-cmds.el: Remove solved todo item. * net/tramp-efs.el: * net/tramp-ftp.el: * net/tramp-gvfs.el: * net/tramp-gw.el: * net/tramp-imap.el: * net/tramp-smb.el: Fix regexps added to `tramp-default-method-alist' and `tramp-default-user-alist', respectively. * net/tramp-gw.el (tramp-gw-open-connection): Use `tramp-get-connection-name' and `tramp-get-connection-buffer'. * net/tramp-imap.el (tramp-imap-make-iht): Use just `tramp-file-name-port'. * net/tramp-sh.el (tramp-methods): Add recursive options to "pscp" and "psftp". Exchange "%k" marker with options. (tramp-do-copy-or-rename-file, tramp-sh-handle-file-local-copy): Compute size of link target. (tramp-do-copy-or-rename-file-out-of-band). Move setting of `tramp-current-*' up due to gateway methods. Optimze computing of copy arguments. Use `tramp-get-connection-name' and `tramp-get-connection-buffer'. Improve debug messages. (tramp-compute-multi-hops): Remove port determination. (tramp-maybe-open-connection): Use `tramp-get-connection-name'. * net/trampver.el: Update release number.
author Michael Albinus <michael.albinus@gmx.de>
date Thu, 02 Dec 2010 20:34:31 +0100
parents 4ba82556d7dd
children f97704487fb3
files lisp/ChangeLog lisp/net/tramp-cmds.el lisp/net/tramp-ftp.el lisp/net/tramp-gvfs.el lisp/net/tramp-gw.el lisp/net/tramp-imap.el lisp/net/tramp-sh.el lisp/net/tramp-smb.el lisp/net/tramp.el lisp/net/trampver.el
diffstat 10 files changed, 146 insertions(+), 109 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/ChangeLog	Thu Dec 02 09:36:45 2010 -0800
+++ b/lisp/ChangeLog	Thu Dec 02 20:34:31 2010 +0100
@@ -1,3 +1,41 @@
+2010-12-02  Michael Albinus  <michael.albinus@gmx.de>
+
+	* net/tramp.el (tramp-local-host-regexp): Add "localhost6".
+	(tramp-file-name-port): Check also for `tramp-default-port'.
+	(tramp-get-connection-name): New defun.
+	(tramp-get-connection-process): Use it.
+	(tramp-debug-message): Extend function exclude list.
+	(tramp-drop-volume-letter): Fix doc string.
+
+	* net/tramp-cmds.el: Remove solved todo item.
+
+	* net/tramp-efs.el:
+	* net/tramp-ftp.el:
+	* net/tramp-gvfs.el:
+	* net/tramp-gw.el:
+	* net/tramp-imap.el:
+	* net/tramp-smb.el: Fix regexps added to `tramp-default-method-alist'
+	and `tramp-default-user-alist', respectively.
+
+	* net/tramp-gw.el (tramp-gw-open-connection): Use
+	`tramp-get-connection-name' and `tramp-get-connection-buffer'.
+
+	* net/tramp-imap.el (tramp-imap-make-iht): Use just
+	`tramp-file-name-port'.
+
+	* net/tramp-sh.el (tramp-methods): Add recursive options to "pscp"
+	and "psftp".  Exchange "%k" marker with options.
+	(tramp-do-copy-or-rename-file, tramp-sh-handle-file-local-copy):
+	Compute size of link target.
+	(tramp-do-copy-or-rename-file-out-of-band). Move setting of
+	`tramp-current-*' up due to gateway methods.  Optimze computing of
+	copy arguments.  Use `tramp-get-connection-name' and
+	`tramp-get-connection-buffer'.  Improve debug messages.
+	(tramp-compute-multi-hops): Remove port determination.
+	(tramp-maybe-open-connection): Use `tramp-get-connection-name'.
+
+	* net/trampver.el: Update release number.
+
 2010-12-02  Glenn Morris  <rgm@gnu.org>
 
 	* emacs-lisp/cl-macs.el (cl-parse-loop-clause):
--- a/lisp/net/tramp-cmds.el	Thu Dec 02 09:36:45 2010 -0800
+++ b/lisp/net/tramp-cmds.el	Thu Dec 02 20:34:31 2010 +0100
@@ -363,12 +363,5 @@
 ;;   flavor)  (Reiner Steib)
 ;; * Let the user edit the connection properties interactively.
 ;;   Something like `gnus-server-edit-server' in Gnus' *Server* buffer.
-;; * It's just that when I come to Customize `tramp-default-user-alist'
-;;   I'm presented with a mismatch and raw lisp for a value.  It is my
-;;   understanding that a variable declared with defcustom is a User
-;;   Option and should not be modified by the code.  add-to-list is
-;;   called in several places. One way to handle that is to have a new
-;;   ordinary variable that gets its initial value from
-;;   tramp-default-user-alist and then is added to.  (Pete Forman)
 
 ;;; tramp-cmds.el ends here
--- a/lisp/net/tramp-ftp.el	Thu Dec 02 09:36:45 2010 -0800
+++ b/lisp/net/tramp-ftp.el	Thu Dec 02 20:34:31 2010 +0100
@@ -107,11 +107,11 @@
 (unless (featurep 'xemacs)
   (add-to-list 'tramp-methods (cons tramp-ftp-method nil)))
 
-;; Add some defaults for `tramp-default-method-alist'
+;; Add some defaults for `tramp-default-method-alist'.
 (add-to-list 'tramp-default-method-alist
-	     (list "\\`ftp\\." "" tramp-ftp-method))
+	     (list "\\`ftp\\." nil tramp-ftp-method))
 (add-to-list 'tramp-default-method-alist
-	     (list "" "\\`\\(anonymous\\|ftp\\)\\'" tramp-ftp-method))
+	     (list nil "\\`\\(anonymous\\|ftp\\)\\'" tramp-ftp-method))
 
 ;; Add completion function for FTP method.
 (tramp-set-completion-function
@@ -221,5 +221,4 @@
 
 ;; * There are no backup files on FTP hosts.
 
-;; arch-tag: 759fb338-5c63-4b99-bd36-b4d59db91cff
 ;;; tramp-ftp.el ends here
--- a/lisp/net/tramp-gvfs.el	Thu Dec 02 09:36:45 2010 -0800
+++ b/lisp/net/tramp-gvfs.el	Thu Dec 02 20:34:31 2010 +0100
@@ -124,8 +124,7 @@
 
 ;; Add a default for `tramp-default-user-alist'.  Rule: For the SYNCE
 ;; method, no user is chosen.
-(add-to-list 'tramp-default-user-alist
-	     '("synce" nil nil))
+(add-to-list 'tramp-default-user-alist '("\\`synce\\'" nil nil))
 
 (defcustom tramp-gvfs-zeroconf-domain "local"
   "*Zeroconf domain to be used for discovering services, like host names."
@@ -1432,5 +1431,4 @@
 ;;   capability.
 ;; * Implement obex for other serial communication but bluetooth.
 
-;; arch-tag: f7f660ce-77f4-4132-9663-f5c25a47f7ed
 ;;; tramp-gvfs.el ends here
--- a/lisp/net/tramp-gw.el	Thu Dec 02 09:36:45 2010 -0800
+++ b/lisp/net/tramp-gw.el	Thu Dec 02 20:34:31 2010 +0100
@@ -44,6 +44,9 @@
   (when (featurep 'xemacs)
       (byte-compiler-options (warnings (- unused-vars)))))
 
+;; We don't add the following methods to `tramp-methods', in order to
+;; exclude them from file name completion.
+
 ;; Define HTTP tunnel method ...
 ;;;###tramp-autoload
 (defconst tramp-gw-tunnel-method "tunnel"
@@ -69,10 +72,12 @@
   (list "Default server" "socks" tramp-gw-default-socks-port 5))
 
 ;; Add a default for `tramp-default-user-alist'.  Default is the local user.
-(add-to-list 'tramp-default-user-alist
-	     `(,tramp-gw-tunnel-method nil ,(user-login-name)))
-(add-to-list 'tramp-default-user-alist
-	     `(,tramp-gw-socks-method nil ,(user-login-name)))
+(add-to-list
+ 'tramp-default-user-alist
+ (list (concat "\\`"
+	       (regexp-opt (list tramp-gw-tunnel-method tramp-gw-socks-method))
+	       "\\'")
+       nil (user-login-name)))
 
 ;; Internal file name functions and variables.
 
@@ -194,8 +199,8 @@
     (setq tramp-gw-gw-proc
 	  (funcall
 	   socks-function
-	   (tramp-buffer-name gw-vec)
-	   (tramp-get-buffer gw-vec)
+	   (tramp-get-connection-name gw-vec)
+	   (tramp-get-connection-buffer gw-vec)
 	   (tramp-file-name-real-host target-vec)
 	   (tramp-file-name-port target-vec)))
     (set-process-sentinel tramp-gw-gw-proc 'tramp-gw-gw-proc-sentinel)
@@ -324,5 +329,4 @@
 ;; * Provide descriptive Commentary.
 ;; * Enable it for several gateway processes in parallel.
 
-;; arch-tag: 277e3a81-fdee-40cf-9e6b-59626292a5e0
 ;;; tramp-gw.el ends here
--- a/lisp/net/tramp-imap.el	Thu Dec 02 09:36:45 2010 -0800
+++ b/lisp/net/tramp-imap.el	Thu Dec 02 20:34:31 2010 +0100
@@ -84,10 +84,6 @@
   (add-to-list 'tramp-methods
 	       (list tramp-imap-method '(tramp-default-port 143))))
 
-;; Add a default for `tramp-default-user-alist'.  Default is the local user.
-(add-to-list 'tramp-default-user-alist
-	     `(,tramp-imap-method nil ,(user-login-name)))
-
 ;; Define Tramp IMAPS method ...
 ;;;###tramp-autoload
 (defconst tramp-imaps-method "imaps"
@@ -100,8 +96,12 @@
 	       (list tramp-imaps-method '(tramp-default-port 993))))
 
 ;; Add a default for `tramp-default-user-alist'.  Default is the local user.
-(add-to-list 'tramp-default-user-alist
-	     `(,tramp-imaps-method nil ,(user-login-name)))
+(add-to-list
+ 'tramp-default-user-alist
+ (list (concat "\\`"
+	       (regexp-opt (list tramp-imap-method tramp-imaps-method))
+	       "\\'")
+       nil (user-login-name)))
 
 ;; Add completion function for IMAP method.
 ;; (tramp-set-completion-function
@@ -746,8 +746,7 @@
 	 (method (tramp-file-name-method vec))
 	 (user (tramp-file-name-user vec))
 	 (ssl (string-equal method tramp-imaps-method))
-	 (port (or (tramp-file-name-port vec)
-		   (tramp-get-method-parameter method 'tramp-default-port)))
+	 (port (tramp-file-name-port vec))
 	 (result (imap-hash-make server port mbox user nil ssl)))
     ;; Return the IHT with a test override to look for the subject
     ;; marker.
@@ -842,5 +841,3 @@
 ;;; (tramp-imap-make-iht (tramp-dissect-file-name "/imap:yourhosthere.com:/test/welcommen"))
 ;;; (tramp-imap-make-iht (tramp-dissect-file-name "/imap:yourhosthere.com:/INBOX.test/4"))
 ;;; (tramp-imap-make-iht (tramp-dissect-file-name "/imap:yourhosthere.com:/INBOX.test/4") "extra")
-
-;; arch-tag: f2723749-58fb-4f29-894e-39708096e850
--- a/lisp/net/tramp-sh.el	Thu Dec 02 09:36:45 2010 -0800
+++ b/lisp/net/tramp-sh.el	Thu Dec 02 20:34:31 2010 +0100
@@ -91,7 +91,7 @@
     (tramp-login-args           (("%h") ("-l" "%u")))
     (tramp-remote-sh            "/bin/sh")
     (tramp-copy-program         "rcp")
-    (tramp-copy-args            (("-p" "%k") ("-r")))
+    (tramp-copy-args            (("%k" "-p") ("-r")))
     (tramp-copy-keep-date       t)
     (tramp-copy-recursive       t)))
 ;;;###tramp-autoload
@@ -101,18 +101,17 @@
     (tramp-login-args           (("%h") ("-l" "%u")))
     (tramp-remote-sh            "/bin/sh")
     (tramp-copy-program         "rcp")
-    (tramp-copy-args            (("-p" "%k")))
+    (tramp-copy-args            (("%k" "-p")))
     (tramp-copy-keep-date       t)))
 ;;;###tramp-autoload
-(add-to-list
- 'tramp-methods
+(add-to-list 'tramp-methods
  '("scp"
    (tramp-login-program        "ssh")
    (tramp-login-args           (("-l" "%u") ("-p" "%p")	("-e" "none") ("%h")))
    (tramp-async-args           (("-q")))
    (tramp-remote-sh            "/bin/sh")
    (tramp-copy-program         "scp")
-   (tramp-copy-args            (("-P" "%p") ("-p" "%k")	("-q") ("-r")))
+   (tramp-copy-args            (("-P" "%p") ("%k" "-p")	("-q") ("-r")))
    (tramp-copy-keep-date       t)
    (tramp-copy-recursive       t)
    (tramp-gw-args              (("-o" "GlobalKnownHostsFile=/dev/null")
@@ -128,7 +127,7 @@
     (tramp-async-args           (("-q")))
     (tramp-remote-sh            "/bin/sh")
     (tramp-copy-program         "scp")
-    (tramp-copy-args            (("-1") ("-P" "%p") ("-p" "%k") ("-q") ("-r")))
+    (tramp-copy-args            (("-1") ("-P" "%p") ("%k" "-p") ("-q") ("-r")))
     (tramp-copy-keep-date       t)
     (tramp-copy-recursive       t)
     (tramp-gw-args              (("-o" "GlobalKnownHostsFile=/dev/null")
@@ -144,7 +143,7 @@
     (tramp-async-args           (("-q")))
     (tramp-remote-sh            "/bin/sh")
     (tramp-copy-program         "scp")
-    (tramp-copy-args            (("-2") ("-P" "%p") ("-p" "%k") ("-q") ("-r")))
+    (tramp-copy-args            (("-2") ("-P" "%p") ("%k" "-p") ("-q") ("-r")))
     (tramp-copy-keep-date       t)
     (tramp-copy-recursive       t)
     (tramp-gw-args              (("-o" "GlobalKnownHostsFile=/dev/null")
@@ -162,7 +161,7 @@
     (tramp-async-args           (("-q")))
     (tramp-remote-sh            "/bin/sh")
     (tramp-copy-program         "scp")
-    (tramp-copy-args            (("-P" "%p") ("-p" "%k") ("-q")
+    (tramp-copy-args            (("-P" "%p") ("%k" "-p") ("-q")
 				 ("-o" "ControlPath=%t.%%r@%%h:%%p")
 				 ("-o" "ControlMaster=auto")))
     (tramp-copy-keep-date       t)
@@ -180,7 +179,7 @@
     (tramp-async-args           (("-q")))
     (tramp-remote-sh            "/bin/sh")
     (tramp-copy-program         "scp")
-    (tramp-copy-args            (("-p" "%k")))
+    (tramp-copy-args            (("%k" "-p")))
     (tramp-copy-keep-date       t)
     (tramp-gw-args              (("-o" "GlobalKnownHostsFile=/dev/null")
 				 ("-o" "UserKnownHostsFile=/dev/null")
@@ -202,7 +201,7 @@
     (tramp-async-args           (("-q")))
     (tramp-remote-sh            "/bin/sh")
     (tramp-copy-program         "rsync")
-    (tramp-copy-args            (("-e" "ssh") ("-t" "%k") ("-r")))
+    (tramp-copy-args            (("-e" "ssh") ("%k" "-t") ("-r")))
     (tramp-copy-keep-date       t)
     (tramp-copy-keep-tmpfile    t)
     (tramp-copy-recursive       t)))
@@ -217,7 +216,7 @@
     (tramp-async-args           (("-q")))
     (tramp-remote-sh            "/bin/sh")
     (tramp-copy-program         "rsync")
-    (tramp-copy-args            (("-t" "%k") ("-r")))
+    (tramp-copy-args            (("%k" "-t") ("-r")))
     (tramp-copy-env             (("RSYNC_RSH")
 				 (,(concat
 				    "ssh"
@@ -347,8 +346,10 @@
     (tramp-login-args           (("-l" "%u") ("-P" "%p") ("-ssh") ("%h")))
     (tramp-remote-sh            "/bin/sh")
     (tramp-copy-program         "pscp")
-    (tramp-copy-args            (("-P" "%p") ("-scp") ("-p" "%k")))
+    (tramp-copy-args            (("-P" "%p") ("-scp") ("%k" "-p")
+				 ("-q") ("-r")))
     (tramp-copy-keep-date       t)
+    (tramp-copy-recursive       t)
     (tramp-password-end-of-line "xy") ;see docstring for "xy"
     (tramp-default-port         22)))
 ;;;###tramp-autoload
@@ -358,8 +359,10 @@
     (tramp-login-args           (("-l" "%u") ("-P" "%p") ("-ssh") ("%h")))
     (tramp-remote-sh            "/bin/sh")
     (tramp-copy-program         "pscp")
-    (tramp-copy-args            (("-P" "%p") ("-sftp") ("-p" "%k")))
+    (tramp-copy-args            (("-P" "%p") ("-sftp") ("%k" "-p")
+				 ("-q") ("-r")))
     (tramp-copy-keep-date       t)
+    (tramp-copy-recursive       t)
     (tramp-password-end-of-line "xy"))) ;see docstring for "xy"
 ;;;###tramp-autoload
 (add-to-list 'tramp-methods
@@ -368,7 +371,7 @@
     (tramp-login-args           (("%h") ("-l" "%u") ("sh" "-i")))
     (tramp-remote-sh            "/bin/sh -i")
     (tramp-copy-program         "fcp")
-    (tramp-copy-args            (("-p" "%k")))
+    (tramp-copy-args            (("%k" "-p")))
     (tramp-copy-keep-date       t)))
 
 (add-to-list 'tramp-default-method-alist
@@ -1943,7 +1946,7 @@
 
 	       ;; Try out-of-band operation.
 	       ((tramp-method-out-of-band-p
-		 v1 (nth 7 (file-attributes filename)))
+		 v1 (nth 7 (file-attributes (file-truename filename))))
 		(tramp-do-copy-or-rename-file-out-of-band
 		 op filename newname keep-date))
 
@@ -1971,7 +1974,8 @@
 
 	   ;; If the Tramp file has an out-of-band method, the
 	   ;; corresponding copy-program can be invoked.
-	   ((tramp-method-out-of-band-p v (nth 7 (file-attributes filename)))
+	   ((tramp-method-out-of-band-p
+	     v (nth 7 (file-attributes (file-truename filename))))
 	    (tramp-do-copy-or-rename-file-out-of-band
 	     op filename newname keep-date))
 
@@ -2178,10 +2182,11 @@
 (defun tramp-do-copy-or-rename-file-out-of-band (op filename newname keep-date)
   "Invoke rcp program to copy.
 The method used must be an out-of-band method."
-  (let ((t1 (tramp-tramp-file-p filename))
-	(t2 (tramp-tramp-file-p newname))
-	copy-program copy-args copy-env copy-keep-date port spec
-	source target)
+  (let* ((t1 (tramp-tramp-file-p filename))
+	 (t2 (tramp-tramp-file-p newname))
+	 (orig-vec (tramp-dissect-file-name (if t1 filename newname)))
+	 copy-program copy-args copy-env copy-keep-date port spec
+	 source target)
 
     (with-parsed-tramp-file-name (if t1 filename newname) nil
       (if (and t1 t2)
@@ -2207,6 +2212,12 @@
 		     (expand-file-name ".." tmpfile) 'recursive)
 		  (delete-file tmpfile)))))
 
+	;; Set variables for computing the prompt for reading
+	;; password.
+	(setq tramp-current-method (tramp-file-name-method v)
+	      tramp-current-user   (tramp-file-name-user v)
+	      tramp-current-host   (tramp-file-name-host v))
+
 	;; Expand hops.  Might be necessary for gateway methods.
 	(setq v (car (tramp-compute-multi-hops v)))
 	(aset v 3 localname)
@@ -2239,16 +2250,20 @@
 	      copy-keep-date (tramp-get-method-parameter
 			      method 'tramp-copy-keep-date)
 	      copy-args
-	      (delq
-	       nil
-	       (mapcar
-		(lambda (x)
-		  (setq
-		   x
-		   ;; " " is indication for keep-date argument.
-		   (delete " " (mapcar (lambda (y) (format-spec y spec)) x)))
-		  (unless (member "" x) (mapconcat 'identity x " ")))
-		(tramp-get-method-parameter method 'tramp-copy-args)))
+	      (delete
+	       ;; " " has either been a replacement of "%k" (when
+	       ;; keep-date argument is non-nil), or a replacemtent
+	       ;; for the whole keep-date sublist.
+	       " "
+	       (dolist
+		   (x
+		    (tramp-get-method-parameter method 'tramp-copy-args)
+		    copy-args)
+		 (setq copy-args
+		       (append
+			copy-args
+			(let ((y (mapcar (lambda (z) (format-spec z spec)) x)))
+			  (if (zerop (length (car y))) '(" ") y))))))
 	      copy-env
 	      (delq
 	       nil
@@ -2266,14 +2281,8 @@
 	  (tramp-error
 	   v 'file-error "Cannot find copy program: %s" copy-program))
 
-	;; Set variables for computing the prompt for reading
-	;; password.
-	(setq tramp-current-method (tramp-file-name-method v)
-	      tramp-current-user   (tramp-file-name-user v)
-	      tramp-current-host   (tramp-file-name-host v))
-
-	(unwind-protect
-	    (with-temp-buffer
+	(with-temp-buffer
+	  (unwind-protect
 	      ;; The default directory must be remote.
 	      (let ((default-directory
 		      (file-name-directory (if t1 filename newname)))
@@ -2284,7 +2293,8 @@
 		(tramp-set-connection-property
 		 v "process-buffer" (current-buffer))
 		(while copy-env
-		  (tramp-message v 5 "%s=\"%s\"" (car copy-env) (cadr copy-env))
+		  (tramp-message
+		   orig-vec 5 "%s=\"%s\"" (car copy-env) (cadr copy-env))
 		  (setenv (pop copy-env) (pop copy-env)))
 
 		;; Use an asynchronous process.  By this, password can
@@ -2295,20 +2305,20 @@
 		(let ((p (let ((default-directory
 				 (tramp-compat-temporary-file-directory)))
 			   (apply 'start-process
-				  (tramp-get-connection-property
-				   v "process-name" nil)
-				  (tramp-get-connection-property
-				   v "process-buffer" nil)
+				  (tramp-get-connection-name v)
+				  (tramp-get-connection-buffer v)
 				  copy-program
 				  (append copy-args (list source target))))))
 		  (tramp-message
-		   v 6 "%s" (mapconcat 'identity (process-command p) " "))
+		   orig-vec 6 "%s"
+		   (mapconcat 'identity (process-command p) " "))
 		  (tramp-compat-set-process-query-on-exit-flag p nil)
-		  (tramp-process-actions p v tramp-actions-copy-out-of-band))))
-
-	  ;; Reset the transfer process properties.
-	  (tramp-set-connection-property v "process-name" nil)
-	  (tramp-set-connection-property v "process-buffer" nil))
+		  (tramp-process-actions p v tramp-actions-copy-out-of-band)))
+
+	    ;; Reset the transfer process properties.
+	    (tramp-message orig-vec 6 "%s" (buffer-string))
+	    (tramp-set-connection-property v "process-name" nil)
+	    (tramp-set-connection-property v "process-buffer" nil)))
 
 	;; Handle KEEP-DATE argument.
 	(when (and keep-date (not copy-keep-date))
@@ -2895,7 +2905,7 @@
        v 'file-error
        "Cannot make local copy of non-existing file `%s'" filename))
 
-    (let* ((size (nth 7 (file-attributes filename)))
+    (let* ((size (nth 7 (file-attributes (file-truename filename))))
 	   (rem-enc (tramp-get-inline-coding v "remote-encoding" size))
 	   (loc-dec (tramp-get-inline-coding v "local-decoding" size))
 	   (tmpfile (tramp-compat-make-temp-file filename)))
@@ -4103,22 +4113,10 @@
       (let ((gw (pop target-alist))
 	    (hop (pop target-alist)))
 	;; Is the method prepared for gateways?
-	(unless (tramp-get-method-parameter
-		 (tramp-file-name-method hop) 'tramp-default-port)
+	(unless (tramp-file-name-port hop)
 	  (tramp-error
 	   vec 'file-error
-	   "Method `%s' is not supported for gateway access."
-	   (tramp-file-name-method hop)))
-	;; Add default port if needed.
-	(unless
-	    (string-match
-	     tramp-host-with-port-regexp (tramp-file-name-host hop))
-	  (aset hop 2
-		(concat
-		 (tramp-file-name-host hop) tramp-prefix-port-format
-		 (number-to-string
-		  (tramp-get-method-parameter
-		   (tramp-file-name-method hop) 'tramp-default-port)))))
+	   "Connection `%s' is not supported for gateway access." hop))
 	;; Open the gateway connection.
 	(add-to-list
 	 'target-alist
@@ -4238,7 +4236,7 @@
 		 (p (let ((default-directory
 			    (tramp-compat-temporary-file-directory)))
 		      (start-process
-		       (or process-name (tramp-buffer-name vec))
+		       (tramp-get-connection-name vec)
 		       (tramp-get-connection-buffer vec)
 		       tramp-encoding-shell))))
 
--- a/lisp/net/tramp-smb.el	Thu Dec 02 09:36:45 2010 -0800
+++ b/lisp/net/tramp-smb.el	Thu Dec 02 20:34:31 2010 +0100
@@ -49,7 +49,7 @@
 ;; Add a default for `tramp-default-user-alist'. Rule: For the SMB method,
 ;; the anonymous user is chosen.
 (add-to-list 'tramp-default-user-alist
-	     `(,tramp-smb-method nil ""))
+	     `(,(concat "\\`" tramp-smb-method "\\'") nil nil))
 
 ;; Add completion function for SMB method.
 (tramp-set-completion-function
--- a/lisp/net/tramp.el	Thu Dec 02 09:36:45 2010 -0800
+++ b/lisp/net/tramp.el	Thu Dec 02 20:34:31 2010 +0100
@@ -386,7 +386,10 @@
 
 (defconst tramp-local-host-regexp
   (concat
-   "^" (regexp-opt (list "localhost" (system-name) "127\.0\.0\.1" "::1") t) "$")
+   "\\`"
+   (regexp-opt
+    (list "localhost" "localhost6" (system-name) "127\.0\.0\.1" "::1") t)
+   "\\'")
   "*Host names which are regarded as local host.")
 
 (defvar tramp-completion-function-alist nil
@@ -1066,10 +1069,12 @@
 (defun tramp-file-name-port (vec)
   "Return the port number of VEC."
   (save-match-data
-    (let ((host (tramp-file-name-host vec)))
-      (and (stringp host)
-	   (string-match tramp-host-with-port-regexp host)
-	   (string-to-number (match-string 2 host))))))
+    (let ((method (tramp-file-name-method vec))
+	  (host (tramp-file-name-host vec)))
+      (or (and (stringp host)
+	       (string-match tramp-host-with-port-regexp host)
+	       (string-to-number (match-string 2 host)))
+	  (tramp-get-method-parameter method 'tramp-default-port)))))
 
 ;;;###tramp-autoload
 (defun tramp-tramp-file-p (name)
@@ -1205,13 +1210,18 @@
   (or (tramp-get-connection-property vec "process-buffer" nil)
       (tramp-get-buffer vec)))
 
+(defun tramp-get-connection-name (vec)
+  "Get the connection name to be used for VEC.
+In case a second asynchronous communication has been started, it is different
+from the default one."
+  (or (tramp-get-connection-property vec "process-name" nil)
+      (tramp-buffer-name vec)))
+
 (defun tramp-get-connection-process (vec)
   "Get the connection process to be used for VEC.
 In case a second asynchronous communication has been started, it is different
 from the default one."
-  (get-process
-   (or (tramp-get-connection-property vec "process-name" nil)
-       (tramp-buffer-name vec))))
+  (get-process (tramp-get-connection-name vec)))
 
 (defun tramp-debug-buffer-name (vec)
   "A name for the debug buffer for VEC."
@@ -1284,7 +1294,7 @@
 	      (setq fn (symbol-name btf))
 	      (unless (and (string-match "^tramp" fn)
 			   (not (string-match
-				 "^tramp\\(-debug\\)?\\(-message\\|-error\\|-compat-funcall\\)$"
+				 "^tramp\\(-debug\\)?\\(-message\\|-error\\|-compat\\(-funcall\\|-with-temp-message\\)\\)$"
 				 fn)))
 		(setq fn nil)))
 	    (setq btn (1+ btn))))
@@ -1454,7 +1464,7 @@
   (if (memq system-type '(cygwin windows-nt))
       (defun tramp-drop-volume-letter (name)
 	"Cut off unnecessary drive letter from file NAME.
-The function `tramp-handle-expand-file-name' calls `expand-file-name'
+The functions `tramp-*-handle-expand-file-name' call `expand-file-name'
 locally on a remote file name.  When the local system is a W32 system
 but the remote system is Unix, this introduces a superfluous drive
 letter into the file name.  This function removes it."
--- a/lisp/net/trampver.el	Thu Dec 02 09:36:45 2010 -0800
+++ b/lisp/net/trampver.el	Thu Dec 02 20:34:31 2010 +0100
@@ -32,7 +32,7 @@
 ;; should be changed only there.
 
 ;;;###tramp-autoload
-(defconst tramp-version "2.2.0"
+(defconst tramp-version "2.2.1-pre"
   "This version of Tramp.")
 
 ;;;###tramp-autoload
@@ -45,7 +45,7 @@
 		      (= emacs-major-version 21)
 		      (>= emacs-minor-version 4)))
 	     "ok"
-	   (format "Tramp 2.2.0 is not fit for %s"
+	   (format "Tramp 2.2.1-pre is not fit for %s"
 		   (when (string-match "^.*$" (emacs-version))
 		     (match-string 0 (emacs-version)))))))
   (unless (string-match "\\`ok\\'" x) (error "%s" x)))