Commits

Anonymous committed 39f1585

Lots of changes to sync with upstream version 2.0.10. See the
lisp/ChangeLog file for details.

Comments (0)

Files changed (6)

-2002-04-15  Kai Großjohann  <Kai.Grossjohann@CS.Uni-Dortmund.DE>
+2002-08-04  Kai Großjohann  <Kai.Grossjohann@CS.Uni-Dortmund.DE>
+
+	Version 2.0.10 released.
+	
+	* tramp.el (tramp-perl-encode-with-module,
+	tramp-perl-decode-with-module)
+	(tramp-perl-encode, tramp-perl-decode): Doc fix.  From Andreas
+	Schwab.
+	(tramp-bug): New variables to report.
+	(tramp-post-connection): After finding shell, wait a bit.  I have
+	no idea why it is necessary, but Daniel also thinks it's
+	necessary.
+	(tramp-uudecode): New variable.  Shell function `tramp_uudecode'
+	for decoding to standard output for those Unices that don't have
+	it.
+	(tramp-post-connection): Install the function on the remote host.
+	(tramp-coding-commands): Add an alternative for using the
+	`tramp_uudecode' shell function.
+
+2002-08-04  Kai Großjohann  <Kai.Grossjohann@CS.Uni-Dortmund.DE>
+
+	Version 2.0.9 released.
+
+	* tramp.el (tramp-bug): Add wording about additional info to
+	include in bug report.
+	(tramp-find-shell): Set $PS1 for invocation of second shell (for
+	tilde expansion).
+	(tramp-find-shell): Shell prompt must match at end of buffer.  Do
+	this also for fallback shell prompt.
+	(tramp-find-shell): More debugging output.
+	(tramp-find-inline-encoding): When checking the decoding command,
+	some commands fail when reading from /dev/null.  So we pass a
+	known string through the encoding command and pass that through
+	the decoding command.  So we know whether the decoding command can
+	deal with some real input.
+
+2002-08-03  Kai Großjohann  <Kai.Grossjohann@CS.Uni-Dortmund.DE>
+
+	Version 2.0.8 released.
+
+	* tramp.el (tramp-perl-encode, tramp-perl-encode): Double the
+	backslashes in the string.
+
+2002-08-03  Kai Großjohann  <Kai.Grossjohann@CS.Uni-Dortmund.DE>
+
+	Version 2.0.6 released.
+
+	* tramp.el (tramp-handle-make-directory): save-excursion.
+	(tramp-default-method): Change to "ssh".
+	(tramp-perl-encode, tramp-perl-decode): New (faster) versions.
+	From Juanma Barranquero <lektu@terra.es>.
+	(tramp-perl-encode-with-module, tramp-perl-decode-with-module) 
+	(tramp-perl-encode, tramp-perl-encode): Strings are passwd
+	through `format', so double all percent characters and document.
+
+2002-07-31  Kai Großjohann  <Kai.Grossjohann@CS.Uni-Dortmund.DE>
+
+	* tramp.el (tramp-wrong-passwd-regexp): Restructure.  Add
+	additional alternative.
+	(tramp-action-permission-denied): Show *tramp/foo* buffer so that
+	the user knows why.
+	(tramp-su-program): Add defvar for this method parameter.  From
+	Juanma Barranquero <lektu@terra.es>.
+	(tramp-perl-encode-with-module): Rename from tramp-perl-encode.
+	(tramp-perl-decode-with-module): Rename from tramp-perl-decode.
+	(tramp-perl-encode, tramp-perl-decode): New implementations that
+	do not use any Perl modules.  From Juanma Barranquero
+	<lektu@terra.es>.
+	(tramp-post-connection): Create shell functions tramp_encode,
+	tramp_decode, tramp_encode_with_module, tramp_decode_with_module
+	for the new Perl snippets.
+	(tramp-coding-commands): Add entries for the two
+	implementations (one with module, one without module).
+	(tramp-handle-file-truename): Invoke Ange-FTP properly.
+	(tramp-handle-expand-many-files): Don't try to invoke Ange-FTP
+	twice.
+
+2002-07-30  Kai Großjohann  <Kai.Grossjohann@CS.Uni-Dortmund.DE>
+
+	* tramp.el (tramp-handle-file-attributes): Restructure logic.
+	(tramp-handle-file-attributes-with-ls) 
+	(tramp-handle-file-attributes-with-perl): Debugging output.
+	(tramp-coding-commands): Provide base64 encoding with recode.
+
+2002-07-29  Kai Großjohann  <Kai.Grossjohann@CS.Uni-Dortmund.DE>
+
+	* Makefile (prepversion): Edit tramp.el instead of creating new
+	file tramp-version.el.
+	(clean): Don't remove tramp-version.el, the file doesn't exist
+	anymore.
+
+	* tramp.el (tramp-perl-encode, tramp-perl-decode): Very simple
+	implementations requiring the Perl module MIME::Base64.
+	(tramp-coding-commands): Use them.
+	(tramp-version): Move back here from tramp-version.el.  The
+	variable is automatically edited from the Makefile.
+	(tramp-login-prompt-regexp, tramp-password-prompt-regexp)
+	(tramp-wrong-passwd-regexp): Remove "$" from regexp, it must match
+	at end of buffer anyway.
+	(tramp-action-login, tramp-action-succeed)
+	(tramp-action-permission-denied, tramp-multi-action-login)
+	(tramp-multi-action-succeed)
+	(tramp-multi-action-permission-denied): Erase buffer when
+	finished.
+	(tramp-process-one-action, tramp-process-one-multi-action):
+	Always search from point-min.
+	(tramp-enter-password): Erase buffer.
+	(tramp-action-yesno): New function.
+	(tramp-yesno-prompt-regexp): New variable.
+	(tramp-actions-before-shell): Use them.
+
+2002-07-28  Kai Großjohann  <Kai.Grossjohann@CS.Uni-Dortmund.DE>
+
+	* tramp.el (tramp-multi-actions): New variable, like
+	tramp-actions-before-shell, but for multi-hop connections.
+	(tramp-perl-encode, tramp-perl-decode): New variables.  Contain
+	Perl code for uuencode, uudecode.
+	(tramp-post-connection): Use new Perl encode/decode implementation.
+	(tramp-coding-commands): Ditto.
+	(tramp-perl-mime-encode, tramp-perl-mime-decode): Remove.  This
+	code does not work.
+	(tramp-invoke-ange-ftp): Require ange-ftp to avoid binding
+	ange-ftp-name-format when it is unbound.
+	(tramp-coding-commands): Remove Perl alternative.  Fix doc.
+
+2002-07-27  Kai Großjohann  <Kai.Grossjohann@CS.Uni-Dortmund.DE>
+
+	* tramp.el (tramp-handle-insert-directory): Expand file name.
+	(tramp-actions-before-shell): New variable of actions to perform
+	before we get a shell prompt.
+	(tramp-action-login, tramp-action-password, tramp-action-succeed)
+	(tramp-action-permission-denied): New functions, used in above
+	variable.
+	(tramp-process-one-action, tramp-process-actions): Process the
+	actions.
+	(tramp-open-connection-telnet, tramp-open-connection-rsh): Use new
+	action mechanism, call tramp-process-actions.
+	(tramp-methods): Replace a lot of methods because of autodetection
+	of mimencode/uuencode.  The new names are a bit longer but more
+	mnemonic.
+	(tramp-maybe-open-connection): Look to see if process is really
+	still alive.
+	(tramp-handle-file-attributes): Make sure to call Ange-FTP in all
+	cases, not only for existing files.  Make sure not to call
+	tramp-handle-file-exists-p on an Ange-FTP filename.
+
+2002-07-26  Kai Großjohann  <Kai.Grossjohann@CS.Uni-Dortmund.DE>
+
+	* tramp.el (tramp-handle-file-local-copy)
+	(tramp-handle-write-region): Call
+	`tramp-get-{de,en}coding-{function,command}' with four args.
+	(tramp-post-connection): Always send Perl implementation of
+	mimencode and mimedecode when Perl is available.
+	(tramp-get-encoding-command, tramp-get-decoding-command)
+	(tramp-get-encoding-function, tramp-get-decoding-function): New
+	implementation, uses auto-detected connection properties.
+
+2002-07-26  Kai Großjohann  <Kai.Grossjohann@CS.Uni-Dortmund.DE>
+
+	* tramp.el (tramp-coding-commands): New variable.
+	(tramp-find-inline-encoding): New function.
+	(tramp-handle-make-directory, tramp-handle-delete-directory)
+	(tramp-handle-delete-file): Do expand-file-name on arg.
+
+2002-07-24  Steve Youngs  <youngs@xemacs.org>
+
+	* Makefile (prepversion): New target to create tramp-version.el.
+	(all): Use it.
+	(clean): Add tramp-version.el.
+
+	* tramp.el (tramp-version): Removed, we create it on the fly from
+	the Makefile.
+
+2002-07-23  Kai Großjohann  <Kai.Grossjohann@CS.Uni-Dortmund.DE>
+
+	Release 2.0.3.
+	
+	* tramp.el (tramp-open-connection-su, tramp-multi-connect-telnet) 
+	(tramp-multi-connect-rlogin, tramp-multi-connect-su) 
+	(tramp-make-tramp-file-name, tramp-make-tramp-multi-file-name):
+	Correct alist for `format-spec', use (a . b) instead of (a b).
+	(tramp-handle-directory-files): Handle fifth, XEmacs-specific,
+	arg FILES-ONLY.
+	(tramp-version): Bump version to 2.0.3.
+
+2002-07-21  Kai Großjohann  <Kai.Grossjohann@CS.Uni-Dortmund.DE>
+
+	* tramp.el (tramp-open-connection-su, tramp-multi-connect-telnet)
+	(tramp-multi-connect-rlogin, tramp-multi-connect-su)
+	(tramp-make-tramp-file-name, tramp-make-tramp-multi-file-name):
+	Use backticks in format-spec for brevity and to avoid
+	character/number confusion in XEmacs.
+
+2002-07-20  Kai Großjohann  <Kai.Grossjohann@CS.Uni-Dortmund.DE>
+
+	* tramp.el (tramp-do-copy-or-rename-via-buffer): New function.
+	(tramp-do-copy-or-rename-file): Use it.  Change and simplify
+	logic.  Omit special case of invoking rcp directly to copy the
+	files.
+
+2002-07-19  Kai Großjohann  <Kai.Grossjohann@CS.Uni-Dortmund.DE>
+
+	* tramp.el (tramp-multi-sh-program): New variable.
+	(tramp-open-connection-multi): Use it.
+	Bump version to 2.0.2.
+
+2002-07-19  Steve Youngs  <youngs@xemacs.org>
+
+	* tramp.el: Revert my previous patch.  It's better to work around
+	the colour prompt problem outside of Tramp, eg in ~/.bashrc or
+	similar. 
+
+2002-07-19  Steve Youngs  <youngs@xemacs.org>
+
+	* tramp.el (tramp-find-shell): Remove "\\'" from regexp so we can
+	deal with shell prompts that have colour control characters in
+	them. 
+	(tramp-open-connection-telnet): Ditto.
+	(tramp-open-connection-rsh): Ditto.
+	(tramp-open-connection-su): Ditto.
+	(tramp-open-connection-multi): Ditto.
+	(tramp-multi-connect-telnet): Ditto.
+	(tramp-multi-connect-rlogin): Ditto.
+	(tramp-multi-connect-su): Ditto.
+	(tramp-open-connection-setup-interactive-shell): Ditto.
+
+2002-07-18  Steve Youngs  <youngs@xemacs.org>
+
+	* tramp.el (tramp-multi-file-name-structure-separate): Typo, it's
+	name was set to 'tramp-file-name-structure-separate'.
+	
+
+2002-07-18  Kai Großjohann  <Kai.Grossjohann@CS.Uni-Dortmund.DE>
+
+	* tramp.el (tramp-methods): Rename methods invoking "ssh1" or
+	"ssh2" to longer names.  Use old names sm1, sm2, su1, su2 and so
+	on for methods invoking "ssh -1" or "ssh -2".
+
+2002-07-13  Kai Großjohann  <Kai.Grossjohann@CS.Uni-Dortmund.DE>
+
+	* tramp.el (tramp-multi-file-name-structure-unified): Add missing
+	initial slash.  Colon is moved from start to end of hop regexp,
+	adjust this regexp accordingly.
+	(tramp-file-name-structure-separate): Bug fix.
+	(tramp-multi-file-name-hop-structure-unified): Move colon from
+	beginning to end.  
+
+2002-07-11  Kai Großjohann  <Kai.Grossjohann@CS.Uni-Dortmund.DE>
+
+	* tramp.el (tramp-handle-make-symbolic-link): Complete implementation.
+
+2002-07-10  Kai Großjohann  <Kai.Grossjohann@CS.Uni-Dortmund.DE>
+
+	* tramp.el (tramp-file-name-structure): Add missing paren.
+	(tramp-file-name-regexp-unified, tramp-file-name-regexp-separate):
+	Add autoload cookies.
+	(tramp-default-method): New default value "sm" for all Emacsen.
+	(tramp-default-method-alist): Invoke Ange-FTP for some user/host
+	combinations on Emacs.
+
+2002-07-09  Kai Großjohann  <Kai.Grossjohann@CS.Uni-Dortmund.DE>
+
+	* tramp.el (tramp-handle-file-name-directory): Don't return "/"
+	for the root directory on a remote host.
+	(tramp-file-name-structure-unified)
+	(tramp-file-name-structure-separate)
+	(tramp-file-name-regexp-unified)
+	(tramp-make-tramp-file-format-unified)
+	(tramp-make-tramp-file-format-separate)
+	(tramp-make-tramp-file-user-nil-format-unified)
+	(tramp-make-tramp-file-user-nil-format-separate)
+	(tramp-multi-file-name-structure-unified)
+	(tramp-multi-file-name-structure-separate)
+	(tramp-file-name-structure-unified)
+	(tramp-file-name-structure-separate)
+	(tramp-multi-file-name-hop-structure-unified)
+	(tramp-multi-file-name-hop-structure-separate)
+	(tramp-make-multi-tramp-file-format-unified)
+	(tramp-make-multi-tramp-file-format-separate): New constants.
+	(tramp-file-name-structure, tramp-file-name-regexp)
+	(tramp-make-tramp-file-format)
+	(tramp-make-tramp-file-user-nil-format)
+	(tramp-multi-file-name-structure)
+	(tramp-file-name-structure)
+	(tramp-multi-file-name-hop-structure)
+	(tramp-make-multi-tramp-file-format): Use them as default values.
+	On Emacs, use the *-unified variants, on XEmacs, use the
+	*-separate variants.  Tramp and Ange-FTP share a common filename
+	syntax on Emacs, but Tramp and EFS use separate filename syntaxes
+	on XEmacs.	
+	(tramp-handle-ange-ftp): Removed.
+	(tramp-disable-ange-ftp): New function to disable Ange-FTP if
+	enabled.  Unconditionally call it at top level when file is
+	loaded.  This should be safe since XEmacs uses EFS.
+	(tramp-default-method): New default value "ftp" on Emacs, "sm" on
+	XEmacs.
+
+2002-07-04  Kai Großjohann  <Kai.Grossjohann@CS.Uni-Dortmund.DE>
+
+	* tramp.el (tramp-handle-ange-ftp): Move interactive spec after
+	docstring.  From Andreas Schwab.
+
+2002-07-03  Kai Großjohann  <Kai.Grossjohann@CS.Uni-Dortmund.DE>
+
+	* tramp.el (tramp-send-eof): Doc string typo.
+	(tramp-kill-process): Likewise.
+	From Juanma Barranquero <lektu@terra.es>.
+
+2002-07-02  Kai Großjohann  <Kai.Grossjohann@CS.Uni-Dortmund.DE>
+
+	* tramp.el (tramp-handle-ange-ftp): Add todo items for handling
+	EFS, too.
+
+2002-06-27  Kai Großjohann  <Kai.Grossjohann@CS.Uni-Dortmund.DE>
+
+	* tramp.el (tramp-handle-ange-ftp): New function to set up Tramp
+	configuration suitable for replacing Ange-FTP.
+	(tramp-repair-jka-compr): Factor out some previously top-level
+	code into an extra function.  Also call it at top-level.
+
+2002-06-26  Kai Großjohann  <Kai.Grossjohann@CS.Uni-Dortmund.DE>
+
+	* tramp.el (tramp-file-name-structure, tramp-file-name-regexp) 
+	(tramp-make-tramp-file-format) 
+	(tramp-make-tramp-file-user-nil-format) 
+	(tramp-multi-file-name-structure) 
+	(tramp-multi-file-name-hop-structure) 
+	(tramp-make-multi-tramp-file-format): Change to an Ange-FTP-like
+	filename syntax.
+	(tramp-handle-ange-ftp, toplevel): Remove Ange-FTP from filename
+	handler alist if tramp-handle-ange-ftp is non-nil.
+	(tramp-handle-delete-file) 
+	(tramp-handle-verify-visited-file-modtime) 
+	(tramp-handle-make-symbolic-link): Fix typos.
+	(tramp-wait-for-regexp, tramp-wait-for-output): Convert int to
+	string before passing it to `insert'.
+
+2002-06-25  Kai Großjohann  <Kai.Grossjohann@CS.Uni-Dortmund.DE>
+
+	* tramp.el (tramp-open-connection-rsh): Provide a hack for a "-p"
+	argument to specify a port number.
+
+	Version 2.0.1 released.
+	
+	* lisp/tramp.el (tramp-version): New version 2.0.1.
+
+2002-06-24  Kai Großjohann  <Kai.Grossjohann@CS.Uni-Dortmund.DE>
+
+	* tramp.el (tramp-handle-file-truename): Don't invoke Ange-FTP.
+	(tramp-invoke-ange-ftp): Remove superfluous IDX-LIST argument.
+	Callers changed.
+
+2002-06-24  Kai Großjohann  <Kai.Grossjohann@CS.Uni-Dortmund.DE>
+
+	* tramp.el (tramp-ftp-method): New user option.
+	(with-parsed-tramp-file-name): New macro for the usual big `let'
+	statement to dissect a file-name.
+	(tramp-handle-make-symbolic-link, tramp-handle-load) 
+	(tramp-handle-file-name-directory) 
+	(tramp-handle-file-name-nondirectory, tramp-handle-file-truename) 
+	(tramp-handle-file-truename, tramp-handle-file-directory-p) 
+	(tramp-handle-file-regular-p, tramp-handle-file-symlink-p) 
+	(tramp-handle-file-writable-p, tramp-handle-file-writable-p): Use
+	the new macro and forward call to Ange-FTP if applicable.
+	(tramp-make-ange-ftp-file-name): New helper function to convert a
+	file name into an Ange-FTP file name, used by
+	`tramp-invoke-ange-ftp'.
+	(tramp-invoke-ange-ftp): New function to forward calls to
+	Ange-FTP.
+
+2002-06-20  Kai Großjohann  <Kai.Grossjohann@CS.Uni-Dortmund.DE>
+
+	* tramp.el (tramp-default-method-alist): New user option.
+	(tramp-find-default-method): Use it.
+
+2002-06-19  Kai Großjohann  <Kai.Grossjohann@CS.Uni-Dortmund.DE>
+
+	* tramp.el (tramp-sh-extra-args): New variable.
+	(tramp-find-shell): Use it.
+
+2002-06-16  Kai Großjohann  <Kai.Grossjohann@CS.Uni-Dortmund.DE>
+
+	* tramp.el: New todo item.
+
+2002-06-15  Kai Großjohann  <Kai.Grossjohann@CS.Uni-Dortmund.DE>
+
+	* tramp.el (tramp-handle-file-truename): Lower numchase-limit
+	(max number of symlink traversals) from 30 to 20.
+
+2002-06-14  Kai Großjohann  <Kai.Grossjohann@CS.Uni-Dortmund.DE>
+
+	* tramp.el (tramp-bug-report-address): Change bug reporting
+	address to Savannah.
+
+2002-06-10  Kai Großjohann  <Kai.Grossjohann@CS.Uni-Dortmund.DE>
+
+	* tramp.el (tramp-methods): New method "fcp".  Suggested by
+	graydon@redhat.com. 
+
+2002-06-04  Kai Großjohann  <Kai.Grossjohann@CS.Uni-Dortmund.DE>
+
+	* tramp.el (tramp-methods): Allow nil where strings are allowed.
+	(tramp-handle-file-truename): Decrease limit on chasing symlinks
+	to provide earlier error message in case of failure.  People might
+	think that Emacs is hanging.
+
+2002-05-22  Kai Großjohann  <Kai.Grossjohann@CS.Uni-Dortmund.DE>
+
+	* tramp.el (tramp-find-shell, tramp-open-connection-telnet) 
+	(tramp-open-connection-rsh, tramp-open-connection-su) 
+	(tramp-open-connection-multi, tramp-multi-connect-telnet) 
+	(tramp-multi-connect-rlogin) 
+	(tramp-open-connection-setup-interactive-shell): Shell prompt
+	must match at end of buffer.	
+
+2002-05-21  Kai Großjohann  <Kai.Grossjohann@CS.Uni-Dortmund.DE>
+
+	* tramp.el (tramp-send-linewise): Use sleep-for instead of sit-for
+	to wait 0.1s.  sit-for does not wait if the user types ahead.
+
+2002-05-20  Kai Großjohann  <Kai.Grossjohann@CS.Uni-Dortmund.DE>
+
+	* tramp.el (tramp-send-linewise): Wait 0.1s instead of 0.001s.
+
+2002-05-19  Kai Großjohann  <Kai.Grossjohann@CS.Uni-Dortmund.DE>
+
+	* tramp.el (tramp-send-linewise): New function.
+	(tramp-post-connection): Use it for sending long strings.
+
+2002-04-16  Kai Großjohann  <Kai.Grossjohann@CS.Uni-Dortmund.DE>
+
+	* tramp.el (tramp-shell-quote-argument): Todo item: don't use
+	`shell-quote-argument'.
+
+2002-04-14  Kai Großjohann  <Kai.Grossjohann@CS.Uni-Dortmund.DE>
 
 	* tramp.el (tramp-methods): New method "pscp".  Suggestion from
 	lawrence mitchell.
 
-2002-04-15  Kai Großjohann  <Kai.Grossjohann@CS.Uni-Dortmund.DE>
+2002-04-14  Kai Großjohann  <Kai.Grossjohann@CS.Uni-Dortmund.DE>
 
 	* tramp.el (file-expand-wildcards): Advise it even on Emacs 21.
 	(tramp-methods): New methods "plinku" and "plinkm".
 
 ;; Author: Daniel Pittman <daniel@danann.net>
 ;; Keywords: comm, processes
-;; Version: $Id$
 
 ;; This file is part of GNU Emacs.
 
 
 ;; Author: Kai.Grossjohann@CS.Uni-Dortmund.DE 
 ;; Keywords: comm, processes
-;; Version: $Id$
 
 ;; This file is part of GNU Emacs.
 
 ;; the same directory.
 ;;
 ;; There's a mailing list for this, as well.  Its name is:
-;;                tramp-devel@lists.sourceforge.net
+;;                tramp-devel@mail.freesoftware.fsf.org
 ;; Send a mail with `help' in the subject (!) to the administration
 ;; address for instructions on joining the list.  The administration
 ;; address is:
-;;            tramp-devel-request@lists.sourceforge.net
+;;            tramp-devel-request@mail.freesoftware.fsf.org
 ;; You can also use the Web to subscribe, under the following URL:
-;;            http://lists.sourceforge.net/lists/listinfo/tramp-devel
+;;            http://mail.freesoftware.fsf.org/mailman/listinfo/tramp-devel
 ;;
 ;; For the adventurous, the current development sources are available
 ;; via CVS.  You can find instructions about this at the following URL:
-;;            http://sourceforge.net/projects/tramp/
+;;            http://savannah.gnu.org/projects/tramp/
 ;; Click on "CVS" in the navigation bar near the top.
 ;;
 ;; Don't forget to put on your asbestos longjohns, first!
 
 ;;; Code:
 
-(defconst tramp-version "$Id$"
+;; In the Tramp CVS repository, the version numer is auto-frobbed from
+;; the Makefile, so you should edit the top-level Makefile to change
+;; the version number.
+(defconst tramp-version "2.0.10"
   "This version of tramp.")
-(defconst tramp-bug-report-address "tramp-devel@lists.sourceforge.net"
+
+(defconst tramp-bug-report-address "tramp-devel@mail.freesoftware.fsf.org"
   "Email address to send bug reports to.")
 
 (require 'timer)
   :group 'tramp
   :type '(file :must-match t))
 
+(defcustom tramp-multi-sh-program
+  (if (memq system-type '(windows-nt))
+      "cmd.exe"
+    tramp-sh-program)
+  "*Use this program for bootstrapping multi-hop connections.
+This variable is similar to `tramp-sh-program', but it is only used
+when initializing a multi-hop connection.  Therefore, the set of
+commands sent to this shell is quite restricted, and if you are
+careful it works to use CMD.EXE under Windows (instead of a Bourne-ish
+shell which does not normally exist on Windows anyway).
+
+To use multi-hop methods from Windows, you also need suitable entries
+in `tramp-multi-connection-function-alist' for the first hop.
+
+This variable defaults to CMD.EXE on Windows NT, and to the value of
+`tramp-sh-program' on other systems."
+  :group 'tramp
+  :type '(file :must-match t))
+
 ;; CCC I have changed all occurrences of comint-quote-filename with
 ;; tramp-shell-quote-argument, except in tramp-handle-expand-many-files.
 ;; There, comint-quote-filename was removed altogether.  If it turns
               (tramp-rcp-keep-date-arg    "-p")
               (tramp-su-program           nil)
               (tramp-su-args              nil)
-              (tramp-encoding-command     nil)
-              (tramp-decoding-command     nil)
-              (tramp-encoding-function    nil)
-              (tramp-decoding-function    nil)
               (tramp-telnet-program       nil)
               (tramp-telnet-args          nil))
      ("scp"   (tramp-connection-function  tramp-open-connection-rsh)
               (tramp-rcp-keep-date-arg    "-p")
               (tramp-su-program           nil)
               (tramp-su-args              nil)
-              (tramp-encoding-command     nil)
-              (tramp-decoding-command     nil)
-              (tramp-encoding-function    nil)
-              (tramp-decoding-function    nil)
               (tramp-telnet-program       nil)
               (tramp-telnet-args          nil))
      ("scp1"  (tramp-connection-function  tramp-open-connection-rsh)
+              (tramp-rsh-program          "ssh")
+              (tramp-rcp-program          "scp")
+              (tramp-remote-sh            "/bin/sh")
+              (tramp-rsh-args             ("-1" "-e" "none"))
+              (tramp-rcp-args             ("-1"))
+              (tramp-rcp-keep-date-arg    "-p")
+              (tramp-su-program           nil)
+              (tramp-su-args              nil)
+              (tramp-telnet-program       nil)
+              (tramp-telnet-args          nil))
+     ("scp2"  (tramp-connection-function  tramp-open-connection-rsh)
+              (tramp-rsh-program          "ssh")
+              (tramp-rcp-program          "scp")
+              (tramp-remote-sh            "/bin/sh")
+              (tramp-rsh-args             ("-2" "-e" "none"))
+              (tramp-rcp-args             ("-2"))
+              (tramp-rcp-keep-date-arg    "-p")
+              (tramp-su-program           nil)
+              (tramp-su-args              nil)
+              (tramp-telnet-program       nil)
+              (tramp-telnet-args          nil))
+     ("scp1-old"
+              (tramp-connection-function  tramp-open-connection-rsh)
               (tramp-rsh-program          "ssh1")
               (tramp-rcp-program          "scp1")
               (tramp-remote-sh            "/bin/sh")
               (tramp-rcp-keep-date-arg    "-p")
               (tramp-su-program           nil)
               (tramp-su-args              nil)
-              (tramp-encoding-command     nil)
-              (tramp-decoding-command     nil)
-              (tramp-encoding-function    nil)
-              (tramp-decoding-function    nil)
               (tramp-telnet-program       nil)
               (tramp-telnet-args          nil))
-     ("scp2"  (tramp-connection-function  tramp-open-connection-rsh)
+     ("scp2-old"
+              (tramp-connection-function  tramp-open-connection-rsh)
               (tramp-rsh-program          "ssh2")
               (tramp-rcp-program          "scp2")
               (tramp-remote-sh            "/bin/sh")
               (tramp-rcp-keep-date-arg    "-p")
               (tramp-su-program           nil)
               (tramp-su-args              nil)
-              (tramp-encoding-command     nil)
-              (tramp-decoding-command     nil)
-              (tramp-encoding-function    nil)
-              (tramp-decoding-function    nil)
               (tramp-telnet-program       nil)
               (tramp-telnet-args          nil))
      ("rsync" (tramp-connection-function  tramp-open-connection-rsh)
               (tramp-rcp-keep-date-arg    "-t")
               (tramp-su-program           nil)
               (tramp-su-args              nil)
-              (tramp-encoding-command     nil)
-              (tramp-decoding-command     nil)
-              (tramp-encoding-function    nil)
-              (tramp-decoding-function    nil)
               (tramp-telnet-program       nil)
               (tramp-telnet-args          nil))
-     ("ru"    (tramp-connection-function  tramp-open-connection-rsh)
+     ("rsh"   (tramp-connection-function  tramp-open-connection-rsh)
               (tramp-rsh-program          "rsh")
               (tramp-rcp-program          nil)
               (tramp-remote-sh            "/bin/sh")
               (tramp-rcp-keep-date-arg    nil)
               (tramp-su-program           nil)
               (tramp-su-args              nil)
-              (tramp-encoding-command     "uuencode xxx")
-              (tramp-decoding-command
-               "( uudecode -o - 2>/dev/null || uudecode -p 2>/dev/null )")
-              (tramp-encoding-function    nil)
-              (tramp-decoding-function    uudecode-decode-region)
               (tramp-telnet-program       nil)
               (tramp-telnet-args          nil))
-     ("su"    (tramp-connection-function  tramp-open-connection-rsh)
+     ("ssh"   (tramp-connection-function  tramp-open-connection-rsh)
               (tramp-rsh-program          "ssh")
               (tramp-rcp-program          nil)
               (tramp-remote-sh            "/bin/sh")
               (tramp-rcp-keep-date-arg    nil)
               (tramp-su-program           nil)
               (tramp-su-args              nil)
-              (tramp-encoding-command     "uuencode xxx")
-              (tramp-decoding-command
-               "( uudecode -o - 2>/dev/null || uudecode -p 2>/dev/null )")
-              (tramp-encoding-function    nil)
-              (tramp-decoding-function    uudecode-decode-region)
               (tramp-telnet-program       nil)
               (tramp-telnet-args          nil))
-     ("su1"   (tramp-connection-function  tramp-open-connection-rsh)
+     ("ssh1"  (tramp-connection-function  tramp-open-connection-rsh)
+              (tramp-rsh-program          "ssh")
+              (tramp-rcp-program          nil)
+              (tramp-remote-sh            "/bin/sh")
+              (tramp-rsh-args             ("-1" "-e" "none"))
+              (tramp-rcp-args             ("-1"))
+              (tramp-rcp-keep-date-arg    nil)
+              (tramp-su-program           nil)
+              (tramp-su-args              nil)
+              (tramp-telnet-program       nil)
+              (tramp-telnet-args          nil))
+     ("ssh2"  (tramp-connection-function  tramp-open-connection-rsh)
+              (tramp-rsh-program          "ssh")
+              (tramp-rcp-program          nil)
+              (tramp-remote-sh            "/bin/sh")
+              (tramp-rsh-args             ("-2" "-e" "none"))
+              (tramp-rcp-args             ("-2"))
+              (tramp-rcp-keep-date-arg    nil)
+              (tramp-su-program           nil)
+              (tramp-su-args              nil)
+              (tramp-telnet-program       nil)
+              (tramp-telnet-args          nil))
+     ("ssh1-old"
+              (tramp-connection-function  tramp-open-connection-rsh)
               (tramp-rsh-program          "ssh1")
               (tramp-rcp-program          nil)
               (tramp-remote-sh            "/bin/sh")
               (tramp-rcp-keep-date-arg    nil)
               (tramp-su-program           nil)
               (tramp-su-args              nil)
-              (tramp-encoding-command     "uuencode xxx")
-              (tramp-decoding-command
-               "( uudecode -o - 2>/dev/null || uudecode -p 2>/dev/null )")
-              (tramp-encoding-function    nil)
-              (tramp-decoding-function    uudecode-decode-region)
               (tramp-telnet-program       nil)
               (tramp-telnet-args          nil))
-     ("su2"   (tramp-connection-function  tramp-open-connection-rsh)
+     ("ssh2-old"
+              (tramp-connection-function  tramp-open-connection-rsh)
               (tramp-rsh-program          "ssh2")
               (tramp-rcp-program          nil)
               (tramp-remote-sh            "/bin/sh")
               (tramp-rcp-keep-date-arg    nil)
               (tramp-su-program           nil)
               (tramp-su-args              nil)
-              (tramp-encoding-command     "uuencode xxx")
-              (tramp-decoding-command
-               "( uudecode -o - 2>/dev/null || uudecode -p 2>/dev/null )")
-              (tramp-encoding-function    nil)
-              (tramp-decoding-function    uudecode-decode-region)
               (tramp-telnet-program       nil)
               (tramp-telnet-args          nil))
-     ("rm"    (tramp-connection-function  tramp-open-connection-rsh)
-              (tramp-rsh-program          "rsh")
-              (tramp-rcp-program          nil)
-              (tramp-remote-sh            "/bin/sh")
-              (tramp-rsh-args             nil)
-              (tramp-rcp-args             nil)
-              (tramp-rcp-keep-date-arg    nil)
-              (tramp-su-program           nil)
-              (tramp-su-args              nil)
-              (tramp-encoding-command     "mimencode -b")
-              (tramp-decoding-command     "mimencode -u -b")
-              (tramp-encoding-function    base64-encode-region)
-              (tramp-decoding-function    base64-decode-region)
-              (tramp-telnet-program       nil)
-              (tramp-telnet-args          nil))
-     ("sm"    (tramp-connection-function  tramp-open-connection-rsh)
-              (tramp-rsh-program          "ssh")
-              (tramp-rcp-program          nil)
-              (tramp-remote-sh            "/bin/sh")
-              (tramp-rsh-args             ("-e" "none"))
-              (tramp-rcp-args             nil)
-              (tramp-rcp-keep-date-arg    nil)
-              (tramp-su-program           nil)
-              (tramp-su-args              nil)
-              (tramp-encoding-command     "mimencode -b")
-              (tramp-decoding-command     "mimencode -u -b")
-              (tramp-encoding-function    base64-encode-region)
-              (tramp-decoding-function    base64-decode-region)
-              (tramp-telnet-program       nil)
-              (tramp-telnet-args          nil))
-     ("smp"   (tramp-connection-function  tramp-open-connection-rsh)
-              (tramp-rsh-program          "ssh")
-              (tramp-rcp-program          nil)
-              (tramp-remote-sh            "/bin/sh")
-              (tramp-rsh-args             ("-e" "none"))
-              (tramp-rcp-args             nil)
-              (tramp-rcp-keep-date-arg    nil)
-              (tramp-su-program           nil)
-              (tramp-su-args              nil)
-              (tramp-encoding-command     "tramp_mimencode")
-              (tramp-decoding-command     "tramp_mimedecode")
-              (tramp-encoding-function    base64-encode-region)
-              (tramp-decoding-function    base64-decode-region)
-              (tramp-telnet-program       nil))
-     ("sm1"   (tramp-connection-function  tramp-open-connection-rsh)
+     ("ssh1-old"
+              (tramp-connection-function  tramp-open-connection-rsh)
               (tramp-rsh-program          "ssh1")
               (tramp-rcp-program          nil)
               (tramp-remote-sh            "/bin/sh")
               (tramp-rcp-keep-date-arg    nil)
               (tramp-su-program           nil)
               (tramp-su-args              nil)
-              (tramp-encoding-command     "mimencode -b")
-              (tramp-decoding-command     "mimencode -u -b")
-              (tramp-encoding-function    base64-encode-region)
-              (tramp-decoding-function    base64-decode-region)
               (tramp-telnet-program       nil)
               (tramp-telnet-args          nil))
-     ("sm2"   (tramp-connection-function  tramp-open-connection-rsh)
+     ("ssh2-old"
+              (tramp-connection-function  tramp-open-connection-rsh)
               (tramp-rsh-program          "ssh2")
               (tramp-rcp-program          nil)
               (tramp-remote-sh            "/bin/sh")
               (tramp-rcp-keep-date-arg    nil)
               (tramp-su-program           nil)
               (tramp-su-args              nil)
-              (tramp-encoding-command     "mimencode -b")
-              (tramp-decoding-command     "mimencode -u -b")
-              (tramp-encoding-function    base64-encode-region)
-              (tramp-decoding-function    base64-decode-region)
               (tramp-telnet-program       nil)
               (tramp-telnet-args          nil))
-     ("tm"    (tramp-connection-function  tramp-open-connection-telnet)
+     ("telnet"
+              (tramp-connection-function  tramp-open-connection-telnet)
               (tramp-rsh-program          nil)
               (tramp-rcp-program          nil)
               (tramp-remote-sh            "/bin/sh")
               (tramp-rcp-keep-date-arg    nil)
               (tramp-su-program           nil)
               (tramp-su-args              nil)
-              (tramp-encoding-command     "mimencode -b")
-              (tramp-decoding-command     "mimencode -u -b")
-              (tramp-encoding-function    base64-encode-region)
-              (tramp-decoding-function    base64-decode-region)
               (tramp-telnet-program       "telnet")
               (tramp-telnet-args          nil))
-     ("tu"    (tramp-connection-function  tramp-open-connection-telnet)
-              (tramp-rsh-program          nil)
-              (tramp-rcp-program          nil)
-              (tramp-remote-sh            "/bin/sh")
-              (tramp-rsh-args             nil)
-              (tramp-rcp-args             nil)
-              (tramp-rcp-keep-date-arg    nil)
-              (tramp-su-program           nil)
-              (tramp-su-args              nil)
-              (tramp-encoding-command     "uuencode xxx")
-              (tramp-decoding-command
-               "( uudecode -o - 2>/dev/null || uudecode -p 2>/dev/null )")
-              (tramp-encoding-function    nil)
-              (tramp-decoding-function    uudecode-decode-region)
-              (tramp-telnet-program       "telnet")
-              (tramp-telnet-args          nil))
-     ("sum"   (tramp-connection-function  tramp-open-connection-su)
+     ("su"    (tramp-connection-function  tramp-open-connection-su)
               (tramp-rsh-program          nil)
               (tramp-rcp-program          nil)
               (tramp-remote-sh            "/bin/sh")
               (tramp-rcp-keep-date-arg    nil)
               (tramp-su-program           "su")
               (tramp-su-args              ("-" "%u"))
-              (tramp-encoding-command     "mimencode -b")
-              (tramp-decoding-command     "mimencode -u -b")
-              (tramp-encoding-function    base64-encode-region)
-              (tramp-decoding-function    base64-decode-region)
               (tramp-telnet-program       nil)
               (tramp-telnet-args          nil))
-     ("suu"   (tramp-connection-function  tramp-open-connection-su)
-              (tramp-rsh-program          nil)
-              (tramp-rcp-program          nil)
-              (tramp-remote-sh            "/bin/sh")
-              (tramp-rsh-args             nil)
-              (tramp-rcp-args             nil)
-              (tramp-rcp-keep-date-arg    nil)
-              (tramp-su-program           "su")
-              (tramp-su-args              ("-" "%u"))
-              (tramp-encoding-command     "uuencode xxx")
-              (tramp-decoding-command
-               "( uudecode -o - 2>/dev/null || uudecode -p 2>/dev/null )")
-              (tramp-encoding-function    nil)
-              (tramp-decoding-function    uudecode-decode-region)
-              (tramp-telnet-program       nil)
-              (tramp-telnet-args          nil))
-     ("sudm"  (tramp-connection-function  tramp-open-connection-su)
+     ("sudo"  (tramp-connection-function  tramp-open-connection-su)
               (tramp-rsh-program          nil)
               (tramp-rcp-program          nil)
               (tramp-remote-sh            "/bin/sh")
               (tramp-rcp-keep-date-arg    nil)
               (tramp-su-program           "sudo")
               (tramp-su-args              ("-u" "%u" "-s"))
-              (tramp-encoding-command     "mimencode -b")
-              (tramp-decoding-command     "mimencode -u -b")
-              (tramp-encoding-function    base64-encode-region)
-              (tramp-decoding-function    base64-decode-region)
-              (tramp-telnet-program       nil)
-              (tramp-telnet-args          nil))
-     ("sudu"  (tramp-connection-function  tramp-open-connection-su)
-              (tramp-rsh-program          nil)
-              (tramp-rcp-program          nil)
-              (tramp-remote-sh            "/bin/sh")
-              (tramp-rsh-args             nil)
-              (tramp-rcp-args             nil)
-              (tramp-rcp-keep-date-arg    nil)
-              (tramp-su-program           "sudo")
-              (tramp-su-args              ("-u" "%u" "-s"))
-              (tramp-encoding-command     "uuencode xxx")
-              (tramp-decoding-command
-               "( uudecode -o - 2>/dev/null || uudecode -p 2>/dev/null )")
-              (tramp-encoding-function    nil)
-              (tramp-decoding-function    uudecode-decode-region)
               (tramp-telnet-program       nil)
               (tramp-telnet-args          nil))
      ("multi" (tramp-connection-function  tramp-open-connection-multi)
               (tramp-rcp-keep-date-arg    nil)
               (tramp-su-program           nil)
               (tramp-su-args              nil)
-              (tramp-encoding-command     "mimencode -b")
-              (tramp-decoding-command     "mimencode -u -b")
-              (tramp-encoding-function    base64-encode-region)
-              (tramp-decoding-function    base64-decode-region)
-              (tramp-telnet-program       nil)
-              (tramp-telnet-args          nil))
-     ("multiu" (tramp-connection-function  tramp-open-connection-multi)
-              (tramp-rsh-program          nil)
-              (tramp-rcp-program          nil)
-              (tramp-remote-sh            "/bin/sh")
-              (tramp-rsh-args             nil)
-              (tramp-rcp-args             nil)
-              (tramp-rcp-keep-date-arg    nil)
-              (tramp-su-program           nil)
-              (tramp-su-args              nil)
-              (tramp-encoding-command     "uuencode xxx")
-              (tramp-decoding-command
-               "( uudecode -o - 2>/dev/null || uudecode -p 2>/dev/null )")
-              (tramp-encoding-function    nil)
-              (tramp-decoding-function    uudecode-decode-region)
               (tramp-telnet-program       nil)
               (tramp-telnet-args          nil))
      ("scpx"  (tramp-connection-function  tramp-open-connection-rsh)
               (tramp-rsh-args             ("-e" "none" "-t" "-t" "/bin/sh"))
               (tramp-rcp-args             nil)
               (tramp-rcp-keep-date-arg    "-p")
-              (tramp-encoding-command     nil)
-              (tramp-decoding-command     nil)
-              (tramp-encoding-function    nil)
-              (tramp-decoding-function    nil)
               (tramp-telnet-program       nil)
               (tramp-telnet-args          nil))
-     ("smx"   (tramp-connection-function  tramp-open-connection-rsh)
+     ("sshx"  (tramp-connection-function  tramp-open-connection-rsh)
               (tramp-rsh-program          "ssh")
               (tramp-rcp-program          nil)
               (tramp-remote-sh            "/bin/sh")
               (tramp-rcp-keep-date-arg    nil)
               (tramp-su-program           nil)
               (tramp-su-args              nil)
-              (tramp-encoding-command     "mimencode -b")
-              (tramp-decoding-command     "mimencode -u -b")
-              (tramp-encoding-function    base64-encode-region)
-              (tramp-decoding-function    base64-decode-region)
               (tramp-telnet-program       nil)
               (tramp-telnet-args          nil))
-     ("km"
+     ("krlogin"
               (tramp-connection-function  tramp-open-connection-rsh)
 	      (tramp-rsh-program          "krlogin")
 	      (tramp-rcp-program          nil)
 	      (tramp-rcp-keep-date-arg    nil)
 	      (tramp-su-program           nil)
 	      (tramp-su-args              nil)
-	      (tramp-encoding-command     "mimencode -b")
-	      (tramp-decoding-command     "mimencode -u -b")
-	      (tramp-encoding-function    base64-encode-region)
-	      (tramp-decoding-function    base64-decode-region)
 	      (tramp-telnet-program       nil)
               (tramp-telnet-args          nil))
-     ("plinku"
+     ("plink"
               (tramp-connection-function  tramp-open-connection-rsh)
 	      (tramp-rsh-program          "plink")
 	      (tramp-rcp-program          nil)
 	      (tramp-rcp-keep-date-arg    nil)
 	      (tramp-su-program           nil)
 	      (tramp-su-args              nil)
-              (tramp-encoding-command     "uuencode xxx")
-              (tramp-decoding-command
-               "( uudecode -o - 2>/dev/null || uudecode -p 2>/dev/null )")
-	      (tramp-encoding-function    nil)
-	      (tramp-decoding-function    uudecode-decode-region)
-	      (tramp-telnet-program       nil)
-              (tramp-telnet-args          nil))
-     ("plinkm"
-              (tramp-connection-function  tramp-open-connection-rsh)
-	      (tramp-rsh-program          "plink")
-	      (tramp-rcp-program          nil)
-	      (tramp-remote-sh            "/bin/sh")
-	      (tramp-rsh-args             ("-ssh")) ;optionally add "-v"
-	      (tramp-rcp-args             nil)
-	      (tramp-rcp-keep-date-arg    nil)
-	      (tramp-su-program           nil)
-	      (tramp-su-args              nil)
-	      (tramp-encoding-command     "mimencode -b")
-	      (tramp-decoding-command     "mimencode -u -b")
-	      (tramp-encoding-function    base64-encode-region)
-	      (tramp-decoding-function    base64-decode-region)
 	      (tramp-telnet-program       nil)
               (tramp-telnet-args          nil))
      ("pscp"
 	      (tramp-rcp-keep-date-arg    "-p")
 	      (tramp-su-program           nil)
 	      (tramp-su-args              nil)
-	      (tramp-encoding-command     nil)
-	      (tramp-decoding-command     nil)
-	      (tramp-encoding-function    nil)
-	      (tramp-decoding-function    nil)
 	      (tramp-telnet-program       nil)
               (tramp-telnet-args          nil))
+     ("fcp"   
+	      (tramp-connection-function  tramp-open-connection-rsh)
+              (tramp-rsh-program          "fsh")
+              (tramp-rcp-program          "fcp")
+              (tramp-remote-sh            "/bin/sh -i")
+              (tramp-rsh-args             ("sh" "-i"))
+              (tramp-rcp-args             nil)
+              (tramp-rcp-keep-date-arg    "-p")
+              (tramp-su-program           nil)
+              (tramp-su-args              nil)
+              (tramp-telnet-program       nil)
+              (tramp-telnet-args          nil))
      )
   "*Alist of methods for remote files.
 This is a list of entries of the form (NAME PARAM1 PARAM2 ...).
   :type '(repeat
           (cons string
                 (set (list (const tramp-connection-function) function)
-                     (list (const tramp-rsh-program) string)
-                     (list (const tramp-rcp-program) string)
-                     (list (const tramp-remote-sh) string)
+                     (list (const tramp-rsh-program)
+			   (choice (const nil) string))
+                     (list (const tramp-rcp-program)
+			   (choice (const nil) string))
+                     (list (const tramp-remote-sh)
+			   (choice (const nil) string))
                      (list (const tramp-rsh-args) (repeat string))
                      (list (const tramp-rcp-args) (repeat string))
-                     (list (const tramp-rcp-keep-date-arg) string)
-                     (list (const tramp-su-program) string)
+                     (list (const tramp-rcp-keep-date-arg)
+			   (choice (const nil) string))
+                     (list (const tramp-su-program)
+			   (choice (const nil) string))
                      (list (const tramp-su-args) (repeat string))
-                     (list (const tramp-encoding-command) string)
-                     (list (const tramp-decoding-command) string)
-                     (list (const tramp-encoding-function) function)
-                     (list (const tramp-decoding-function) function)
-                     (list (const tramp-telnet-program) string)
+                     (list (const tramp-encoding-command)
+			   (choice (const nil) string))
+                     (list (const tramp-decoding-command)
+			   (choice (const nil) string))
+                     (list (const tramp-encoding-function)
+			   (choice (const nil) function))
+                     (list (const tramp-decoding-function)
+			   (choice (const nil) function))
+                     (list (const tramp-telnet-program)
+			   (choice (const nil) string))
                      (list (const tramp-telnet-args) (repeat string))))))
 
 (defcustom tramp-multi-methods '("multi" "multiu")
   :group 'tramp
   :type '(repeat (list string function string)))
 
-(defcustom tramp-default-method "rcp"
+(defcustom tramp-default-method "ssh"
   "*Default method to use for transferring files.
-See `tramp-methods' for possibilities."
+See `tramp-methods' for possibilities.
+Also see `tramp-default-method-alist'.
+
+Emacs uses a unified filename syntax for Tramp and Ange-FTP.
+For backward compatibility, the default value of this variable
+is \"ftp\" on Emacs.  But XEmacs uses a separate filename syntax
+for Tramp and EFS, so there the default method is \"sm\"."
+  :group 'tramp
+  :type 'string)
+
+(defcustom tramp-default-method-alist
+  (if (featurep 'xemacs)
+      nil
+    '(("\\`ftp\\." "" "ftp")
+      ("" "\\`\\(anonymous\\|ftp\\)\\'" "ftp")))
+  "*Default method to use for specific user/host pairs.
+This is an alist of items (HOST USER METHOD).  The first matching item
+specifies the method to use for a file name which does not specify a
+method.  HOST and USER are regular expressions or nil, which is
+interpreted as a regular expression which always matches.  If no entry
+matches, the variable `tramp-default-method' takes effect.
+
+If the file name does not specify the user, lookup is done using the
+empty string for the user name.
+
+See `tramp-methods' for a list of possibilities for METHOD."
+  :group 'tramp
+  :type '(repeat (list (regexp :tag "Host regexp")
+		       (regexp :tag "User regexp")
+		       (string :tag "Method"))))
+
+(defcustom tramp-ftp-method "ftp"
+  "*When this method name is used, forward all calls to Ange-FTP."
   :group 'tramp
   :type 'string)
 
   :type '(repeat string))
 
 (defcustom tramp-login-prompt-regexp
-  ".*ogin: *$"
+  ".*ogin: *"
   "*Regexp matching login-like prompts.
-The regexp should match the whole line."
+The regexp should match at end of buffer."
   :group 'tramp
   :type 'regexp)
 
 (defcustom tramp-password-prompt-regexp
-  "^.*\\([pP]assword\\|passphrase.*\\):\^@? *$"
+  "^.*\\([pP]assword\\|passphrase.*\\):\^@? *"
   "*Regexp matching password-like prompts.
-The regexp should match the whole line.
+The regexp should match at end of buffer.
 
 The `sudo' program appears to insert a `^@' character into the prompt."
   :group 'tramp
   :type 'regexp)
 
 (defcustom tramp-wrong-passwd-regexp
-  (concat "^.*\\(Permission denied.\\|Login [Ii]ncorrect\\|"
-          "Received signal [0-9]+\\|Connection \\(refused\\|closed\\)\\|"
-          "Sorry, try again.\\|Name or service not known\\).*$")
+  (concat "^.*"
+	  ;; These strings should be on the last line
+	  (regexp-opt '("Permission denied."
+			"Login incorrect"
+			"Login Incorrect"
+			"Connection refused"
+			"Connection closed"
+			"Sorry, try again."
+			"Name or service not known"
+			"Host key verification failed.") t)
+	  ".*"
+	  "\\|"
+	  "^.*\\("
+	  ;; Here comes a list of regexes, separated by \\|
+	  "Received signal [0-9]+"
+	  "\\).*")
   "*Regexp matching a `login failed' message.
-The regexp should match the whole line."
+The regexp should match at end of buffer."
+  :group 'tramp
+  :type 'regexp)
+
+(defcustom tramp-yesno-prompt-regexp
+  "Are you sure you want to continue connecting (yes/no)\\? *"
+  "Regular expression matching all queries which need to be confirmed.
+The confirmation should be done with yes or no.
+The regexp should match at end of buffer."
   :group 'tramp
   :type 'regexp)
 
   :group 'tramp
   :type 'boolean)
 
+(defcustom tramp-sh-extra-args '(("/bash\\'" . "--norc"))
+  "*Alist specifying extra arguments to pass to the remote shell.
+Entries are (REGEXP . ARGS) where REGEXP is a regular expression
+matching the shell file name and ARGS is a string specifying the
+arguments.
+
+This variable is only used when Tramp needs to start up another shell
+for tilde expansion.  The extra arguments should typically prevent the
+shell from reading its init file."
+  :group 'tramp
+  :type '(alist :key-type string :value-type string))
+
 ;; File name format.
 
+(defconst tramp-file-name-structure-unified
+  (list (concat "\\`/\\(\\([a-zA-Z0-9-]+\\):\\)?" ;method
+		      "\\(\\([^:@/]+\\)@\\)?" ;user
+		      "\\([^:/]+\\):"	;host
+		      "\\(.*\\)\\'")	;path
+	      2 4 5 6)
+  "Default value for `tramp-file-name-structure' for unified remoting.
+On Emacs (not XEmacs), the Tramp and Ange-FTP packages use a unified
+filename space.  This value is used for this unified namespace.")
+
+(defconst tramp-file-name-structure-separate
+  (list (concat "\\`/\\[\\(\\([a-zA-Z0-9-]+\\)/\\)?" ;method
+		"\\(\\([-a-zA-Z0-9_#/:]+\\)@\\)?" ;user
+		"\\([-a-zA-Z0-9_#/:@.]+\\)\\]" ;host
+		"\\(.*\\)\\'")		;path
+        2 4 5 6)
+  "Default value for `tramp-file-name-structure' for separate remoting.
+On XEmacs, the Tramp and EFS packages use a separate namespace for
+remote filenames.  This value is used in that case.  It is designed
+not to clash with the EFS filename syntax.")
+
 (defcustom tramp-file-name-structure
-  (list "\\`/\\[\\(\\([a-zA-Z0-9]+\\)/\\)?\\(\\([-a-zA-Z0-9_#/:]+\\)@\\)?\\([-a-zA-Z0-9_#/:@.]+\\)\\]\\(.*\\)\\'"
-        2 4 5 6)
+  (if (featurep 'xemacs)
+      tramp-file-name-structure-separate
+    tramp-file-name-structure-unified)
   "*List of five elements (REGEXP METHOD USER HOST FILE), detailing \
 the tramp file name structure.
 
                (integer :tag "Paren pair for file name  ")))
 
 ;;;###autoload
-(defcustom tramp-file-name-regexp "\\`/\\[.*\\]"
+(defconst tramp-file-name-regexp-unified
+  "\\`/[^/:]+:"
+  "Value for `tramp-file-name-regexp' for unified remoting.
+Emacs (not XEmacs) uses a unified filename syntax for Ange-FTP and
+Tramp.  See `tramp-file-name-structure-unified' for more explanations.")
+
+;;;###autoload
+(defconst tramp-file-name-regexp-separate
+  "\\`/\\[.*\\]"
+  "Value for `tramp-file-name-regexp' for separate remoting.
+XEmacs uses a separate filename syntax for Tramp and EFS.
+See `tramp-file-name-structure-separate' for more explanations.")
+
+;;;###autoload
+(defcustom tramp-file-name-regexp
+  (if (featurep 'xemacs)
+      tramp-file-name-regexp-separate
+    tramp-file-name-regexp-unified)
   "*Regular expression matching file names handled by tramp.
 This regexp should match tramp file names but no other file names.
 \(When tramp.el is loaded, this regular expression is prepended to
   :group 'tramp
   :type 'regexp)
 
-(defcustom tramp-make-tramp-file-format "/[%m/%u@%h]%p"
+(defconst tramp-make-tramp-file-format-unified
+   "/%m:%u@%h:%p"
+   "Value for `tramp-make-tramp-file-format' for unified remoting.
+Emacs (not XEmacs) uses a unified filename syntax for Ange-FTP and Tramp.
+See `tramp-file-name-structure-unified' for more details.")
+
+(defconst tramp-make-tramp-file-format-separate
+  "/[%m/%u@%h]%p"
+  "Value for `tramp-make-tramp-file-format' for separate remoting.
+XEmacs uses a separate filename syntax for EFS and Tramp.
+See `tramp-file-name-structure-separate' for more details.")
+
+(defcustom tramp-make-tramp-file-format
+  (if (featurep 'xemacs)
+      tramp-make-tramp-file-format-separate
+    tramp-make-tramp-file-format-unified)
   "*Format string saying how to construct tramp file name.
 `%m' is replaced by the method name.
 `%u' is replaced by the user name.
   :group 'tramp
   :type 'string)
 
-;; HHH: New.  This format spec is made to handle the cases where the
-;;      user does not provide a user name for the connection.
-(defcustom tramp-make-tramp-file-user-nil-format "/[%m/%h]%p"
+(defconst tramp-make-tramp-file-user-nil-format-unified
+  "/%m:%h:%p"
+  "Value of `tramp-make-tramp-file-user-nil-format' for unified remoting.
+Emacs (not XEmacs) uses a unified filename syntax for Ange-FTP and Tramp.
+See `tramp-file-name-structure-unified' for details.")
+
+(defconst tramp-make-tramp-file-user-nil-format-separate
+  "/[%m/%h]%p"
+  "Value of `tramp-make-tramp-file-user-nil-format' for separate remoting.
+XEmacs uses a separate filename syntax for EFS and Tramp.
+See `tramp-file-name-structure-separate' for details.")
+
+(defcustom tramp-make-tramp-file-user-nil-format
+  (if (featurep 'xemacs)
+      tramp-make-tramp-file-user-nil-format-separate
+    tramp-make-tramp-file-user-nil-format-unified)
   "*Format string saying how to construct tramp file name when the user name is not known.
 `%m' is replaced by the method name.
 `%h' is replaced by the host name.
   :group 'tramp
   :type 'string)
 
-(defcustom tramp-multi-file-name-structure
+(defconst tramp-multi-file-name-structure-unified
+  (list (concat "\\`/\\(\\([a-zA-Z0-9]+\\)?:\\)" ;method
+		"\\(\\(%s\\)+\\)"	;hops
+		"\\(.*\\)\\'")		;path
+	2 3 -1)
+  "Value for `tramp-multi-file-name-structure' for unified remoting.
+Emacs (not XEmacs) uses a unified filename syntax for Ange-FTP and Tramp.
+See `tramp-file-name-structure-unified' for details.")
+
+(defconst tramp-multi-file-name-structure-separate
   (list (concat
          ;; prefix
-         "\\`/\\[\\(\\([a-z0-9]+\\)\\)?"
-         ;; regexp specifying a hop
+         "\\`/\\[\\(\\([a-z0-9]+\\)?\\)"
+         ;; regexp specifying the hops
          "\\(\\(%s\\)+\\)"
          ;; path name
          "\\]\\(.*\\)\\'")
         2                               ;number of pair to match method
         3                               ;number of pair to match hops
         -1)                             ;number of pair to match path
-
+  "Value of `tramp-multi-file-name-structure' for separate remoting.
+XEmacs uses a separate filename syntax for EFS and Tramp.
+See `tramp-file-name-structure-separate' for details.")
+
+(defcustom tramp-multi-file-name-structure
+  (if (featurep 'xemacs)
+      tramp-multi-file-name-structure-separate
+    tramp-multi-file-name-structure-unified)
   "*Describes the file name structure of `multi' files.
 Multi files allow you to contact a remote host in several hops.
 This is a list of four elements (REGEXP METHOD HOP PATH).
                (integer :tag "Paren pair for hops")
                (integer :tag "Paren pair to match path")))
 
+(defconst tramp-multi-file-name-hop-structure-unified
+  (list (concat "\\([a-zA-z0-9_]+\\):" ;hop method
+		"\\([^@:/]+\\)@"	;user
+		"\\([^:/]+\\):")	;host
+	1 2 3)
+  "Value of `tramp-multi-file-name-hop-structure' for unified remoting.
+Emacs (not XEmacs) uses a unified filename syntax for Ange-FTP and Tramp.
+See `tramp-file-name-structure-unified' for details.")
+
+(defconst tramp-multi-file-name-hop-structure-separate
+  (list (concat "/\\([a-z0-9_]+\\):"	;hop method
+		"\\([a-z0-9_]+\\)@"	;user
+		"\\([a-z0-9.-]+\\)")	;host
+        1 2 3)
+  "Value of `tramp-multi-file-name-hop-structure' for separate remoting.
+XEmacs uses a separate filename syntax for EFS and Tramp.
+See `tramp-file-name-structure-separate' for details.")
+
 (defcustom tramp-multi-file-name-hop-structure
-  (list "/\\([a-z0-9_]+\\):\\([a-z0-9_]+\\)@\\([a-z0-9.-]+\\)"
-        1 2 3)
+  (if (featurep 'xemacs)
+      tramp-multi-file-name-hop-structure-separate
+    tramp-multi-file-name-hop-structure-unified)
   "*Describes the structure of a hop in multi files.
 This is a list of four elements (REGEXP METHOD USER HOST).  First
 element REGEXP is used to match against the hop.  Pair number METHOD
                (integer :tag "Paren pair for user name")
                (integer :tag "Paren pair for host name")))
 
+(defconst tramp-make-multi-tramp-file-format-unified
+  (list "/%m" ":%m:%u@%h" ":%p")
+  "Value of `tramp-make-multi-tramp-file-format' for unified remoting.
+Emacs (not XEmacs) uses a unified filename syntax for Ange-FTP and Tramp.
+See `tramp-file-name-structure-unified' for details.")
+
+(defconst tramp-make-multi-tramp-file-format-separate
+  (list "/[%m" "/%m:%u@%h" "]%p")
+  "Value of `tramp-make-multi-tramp-file-format' for separate remoting.
+XEmacs uses a separate filename syntax for EFS and Tramp.
+See `tramp-file-name-structure-separate' for details.")
+
 (defcustom tramp-make-multi-tramp-file-format
-  (list "/[%m" "/%m:%u@%h" "]%p")
+  (if (featurep 'xemacs)
+      tramp-make-multi-tramp-file-format-separate
+    tramp-make-multi-tramp-file-format-unified)
   "*Describes how to construct a `multi' file name.
 This is a list of three elements PREFIX, HOP and PATH.
 
   :group 'tramp
   :type 'boolean)
 
+(defcustom tramp-actions-before-shell
+  '((tramp-password-prompt-regexp tramp-action-password)
+    (tramp-login-prompt-regexp tramp-action-login)
+    (shell-prompt-pattern tramp-action-succeed)
+    (tramp-wrong-passwd-regexp tramp-action-permission-denied)
+    (tramp-yesno-prompt-regexp tramp-action-yesno))
+  "List of pattern/action pairs.
+Whenever a pattern matches, the corresponding action is performed.
+Each item looks like (PATTERN ACTION).
+
+The PATTERN should be a symbol, a variable.  The value of this
+variable gives the regular expression to search for.  Note that the
+regexp must match at the end of the buffer, \"\\'\" is implicitly
+appended to it.
+
+The ACTION should also be a symbol, but a function.  When the
+corresponding PATTERN matches, the ACTION function is called."
+  :group 'tramp
+  :type '(repeat (list variable function)))
+
+(defcustom tramp-multi-actions
+  '((tramp-password-prompt-regexp tramp-multi-action-password)
+    (tramp-login-prompt-regexp tramp-multi-action-login)
+    (shell-prompt-pattern tramp-multi-action-succeed)
+    (tramp-wrong-passwd-regexp tramp-multi-action-permission-denied))
+  "List of pattern/action pairs.
+This list is used for each hop in multi-hop connections.
+See `tramp-actions-before-shell' for more info."
+  :group 'tramp
+  :type '(repeat (list variable function)))
+
 ;;; Internal Variables:
 
 (defvar tramp-buffer-file-attributes nil
 In the connection buffer, this variable has the value of the like-named
 method parameter, as specified in `tramp-methods' (which see).")
 
+(defvar tramp-su-program nil
+  "This internal variable holds a parameter for `tramp-methods'.
+In the connection buffer, this variable has the value of the like-named
+method parameter, as specified in `tramp-methods' (which see).")
+
 ;; CCC `local in each buffer'?
 (defvar tramp-ls-command nil
   "This command is used to get a long listing with numeric user and group ids.
 This variable is automatically made buffer-local to each rsh process buffer
 upon opening the connection.")
 
-;; Perl script to implement `file-attributes' in a Lisp `read'able output.
-;; If you are hacking on this, note that you get *no* output unless this
-;; spits out a complete line, including the '\n' at the end.
+(defconst tramp-uudecode "\
+tramp_uudecode () {
+\(echo begin 600 /tmp/tramp.$$; tail +2) | uudecode
+cat /tmp/tramp.$$
+rm -f /tmp/tramp.$$
+}"
+  "Shell function to implement `uudecode' to standard output.
+Many systems support `uudecode -o -' for this or `uudecode -p', but
+some systems don't, and for them we have this shell function.")
+
+;; Perl script to implement `file-attributes' in a Lisp `read'able
+;; output.  If you are hacking on this, note that you get *no* output
+;; unless this spits out a complete line, including the '\n' at the
+;; end.
 (defconst tramp-perl-file-attributes (concat
  "$f = $ARGV[0];
 @s = lstat($f);
   "Perl script to produce output suitable for use with `file-attributes'
 on the remote file system.")
 
-;; Perl script to implement `mime-encode'
-(defvar tramp-perl-mime-encode (concat
- "sub encode_base64 ($);
-  my $buf;
-  while(read(STDIN, $buf, 60*57)) { print encode_base64($buf) }
-  sub encode_base64 ($) {
-    my $res = \"\";
-    my $eol = \"\n\";
-    pos($_[0]) = 0;                          # ensure start at the beginning
-    while ($_[0] =~ /(.{1,45})/gs) {
-	$res .= substr(pack(\"u\", $1), 1);
-	chop($res);
+;; ;; These two use uu encoding.
+;; (defvar tramp-perl-encode "%s -e'\
+;; print qq(begin 644 xxx\n);
+;; my $s = q();
+;; my $res = q();
+;; while (read(STDIN, $s, 45)) {
+;;     print pack(q(u), $s);
+;; }
+;; print qq(`\n);
+;; print qq(end\n);
+;; '"
+;;   "Perl program to use for encoding a file.
+;; Escape sequence %s is replaced with name of Perl binary.")
+
+;; (defvar tramp-perl-decode "%s -ne '
+;; print unpack q(u), $_;
+;; '"
+;;   "Perl program to use for decoding a file.
+;; Escape sequence %s is replaced with name of Perl binary.")
+
+;; These two use base64 encoding.
+(defvar tramp-perl-encode-with-module
+  "perl -MMIME::Base64 -0777 -ne 'print encode_base64($_)'"
+  "Perl program to use for encoding a file.
+Escape sequence %s is replaced with name of Perl binary.
+This string is passed to `format', so percent characters need to be doubled.
+This implementation requires the MIME::Base64 Perl module to be installed
+on the remote host.")
+
+(defvar tramp-perl-decode-with-module
+  "perl -MMIME::Base64 -0777 -ne 'print decode_base64($_)'"
+  "Perl program to use for decoding a file.
+Escape sequence %s is replaced with name of Perl binary.
+This string is passed to `format', so percent characters need to be doubled.
+This implementation requires the MIME::Base64 Perl module to be installed
+on the remote host.")
+
+(defvar tramp-perl-encode
+  "%s -e '
+# This script contributed by Juanma Barranquero <lektu@terra.es>.
+# Copyright (C) 2002 Free Software Foundation, Inc.
+use strict;
+
+my %%trans = do {
+    my $i = 0;
+    map {(substr(unpack(q(B8), chr $i++), 2, 6), $_)}
+      split //, q(ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/);
+};
+
+binmode(\\*STDIN);
+
+# We read in chunks of 54 bytes, to generate output lines
+# of 72 chars (plus end of line)
+$/ = \\54;
+
+while (my $data = <STDIN>) {
+    my $pad = q();
+
+    # Only for the last chunk, and only if did not fill the last three-byte packet
+    if (eof) {
+        my $mod = length($data) %% 3;
+        $pad = q(=) x (3 - $mod) if $mod;
     }
-    $res =~ tr|` -_|AA-Za-z0-9+/|;               # `# help emacs
-    # fix padding at the end
-    my $padding = (3 - length($_[0]) % 3) % 3;
-    $res =~ s/.{$padding}$/\"=\" x $padding/e if $padding;
-    # break encoded string into lines of no more than 76 characters each
-    if (length $eol) {
-	$res =~ s/(.{1,76})/$1$eol/g;
-    }
-    $res;}"))
-
-;; Perl script to implement `mime-decode'
-(defvar tramp-perl-mime-decode (concat
- "sub decode_base64 ($);
-  my $buf;
-  while(read(STDIN, $buf, 60*57)) { print decode_base64($buf) }
-  sub decode_base64 ($) {
-    local($^W) = 0; # unpack(\"u\",...) gives bogus warning in 5.00[123]
-
-    my $str = shift;
-    my $res = \"\";
-
-    $str =~ tr|A-Za-z0-9+=/||cd;            # remove non-base64 chars
-    if (length($str) % 4) {
-	warn(\"Length of base64 data not a multiple of 4\")
-    }
-    $str =~ s/=+$//;                        # remove padding
-    $str =~ tr|A-Za-z0-9+/| -_|;            # convert to uuencoded format
-    while ($str =~ /(.{1,60})/gs) {
-	my $len = chr(32 + length($1)*3/4); # compute length byte
-	$res .= unpack(\"u\", $len . $1 );    # uudecode
-    }
-    $res;}"))
+
+    # Not the fastest method, but it is simple: unpack to binary string, split
+    # by groups of 6 bits and convert back from binary to byte; then map into
+    # the translation table
+    print
+      join q(),
+        map($trans{$_},
+            (substr(unpack(q(B*), $data) . q(00000), 0, 432) =~ /....../g)),
+              $pad,
+                qq(\\n);
+}
+'"
+  "Perl program to use for encoding a file.
+Escape sequence %s is replaced with name of Perl binary.
+This string is passed to `format', so percent characters need to be doubled.")
+
+(defvar tramp-perl-decode
+  "%s -e '
+# This script contributed by Juanma Barranquero <lektu@terra.es>.
+# Copyright (C) 2002 Free Software Foundation, Inc.
+use strict;
+
+my %%trans = do {
+    my $i = 0;
+    map {($_, sprintf(q(%%06b), $i++))}
+      split //, q(ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/)
+};
+
+my %%bytes = map {(unpack(q(B8), chr $_), chr $_)} 0 .. 255;
+
+binmode(\\*STDOUT);
+
+# We are going to accumulate into $pending to accept any line length
+# (we do not check they are <= 76 chars as the RFC says)
+my $pending = q();
+
+while (my $data = <STDIN>) {
+    chomp $data;
+
+    # If we find one or two =, we have reached the end and
+    # any following data is to be discarded
+    my $finished = $data =~ s/(==?).*/$1/;
+    $pending .= $data;
+
+    my $len = length($pending);
+    my $chunk = substr($pending, 0, $len & ~3, q());
+
+    # Easy method: translate from chars to (pregenerated) six-bit packets, join,
+    # split in 8-bit chunks and convert back to char.
+    print join q(),
+      map $bytes{$_},
+        ((join q(), map {$trans{$_} || q()} split //, $chunk) =~ /......../g);
+
+    last if $finished;
+}
+'"
+  "Perl program to use for decoding a file.
+Escape sequence %s is replaced with name of Perl binary.
+This string is passed to `format', so percent characters need to be doubled.")
 
 ; These values conform to `file-attributes' from XEmacs 21.2.
 ; GNU Emacs and other tools not checked.
     'undecided-dos)
   "Some Emacsen know the `dos' coding system, others need `undecided-dos'.")
 
+(defvar tramp-last-cmd-time nil
+  "Internal Tramp variable recording the time when the last cmd was sent.
+This variable is buffer-local in every buffer.")
+(make-variable-buffer-local 'tramp-last-cmd-time)
 
 ;; New handlers should be added here.  The following operations can be
 ;; handled using the normal primitives: file-name-as-directory,
         "Alist of handler functions.
 Operations not mentioned here will be handled by the normal Emacs functions.")
 
-;;; For better error reporting.
-
-(defun tramp-version (arg)
-  "Print version number of tramp.el in minibuffer or current buffer."
-  (interactive "P")
-  (if arg (insert tramp-version) (message tramp-version)))
-
 ;;; Internal functions which must come first.
 
 (defsubst tramp-message (level fmt-string &rest args)
    ((fboundp 'point-at-eol) 	 (funcall 'point-at-eol))
    (t (save-excursion (end-of-line) (point)))))
 
+(defmacro with-parsed-tramp-file-name (filename var &rest body)
+  "Parse a Tramp filename and make components available in the body.
+
+First arg FILENAME is evaluated and dissected into its components.
+Second arg VAR is a symbol.  It is used as a variable name to hold
+the filename structure.  It is also used as a prefix for the variables
+holding the components.  For example, if VAR is the symbol `foo', then
+`foo' will be bound to the whole structure, `foo-multi-method' will
+be bound to the multi-method component, and so on for `foo-method',
+`foo-user', `foo-host', `foo-path'.
+
+Remaining args are Lisp expressions to be evaluated (inside an implicit
+`progn').
+
+If VAR is nil, then we bind `v' to the structure and `multi-method',
+`method', `user', `host', `path' to the components."
+  `(let* ((,(or var 'v) (tramp-dissect-file-name ,filename))
+	  (,(if var (intern (concat (symbol-name var) "-multi-method")) 'multi-method)
+	   (tramp-file-name-multi-method ,(or var 'v)))
+	  (,(if var (intern (concat (symbol-name var) "-method")) 'method)
+	   (tramp-file-name-method ,(or var 'v)))
+	  (,(if var (intern (concat (symbol-name var) "-user")) 'user)
+	   (tramp-file-name-user ,(or var 'v)))
+	  (,(if var (intern (concat (symbol-name var) "-host")) 'host)
+	   (tramp-file-name-host ,(or var 'v)))
+	  (,(if var (intern (concat (symbol-name var) "-path")) 'path)
+	   (tramp-file-name-path ,(or var 'v))))
+     ,@body))
+
+(put 'with-parsed-tramp-file-name 'lisp-indent-function 2)
+
 ;;; File Name Handler Functions:
 
-;; The following file name handler ops are not implemented (yet?).
-
 (defun tramp-handle-make-symbolic-link
   (filename linkname &optional ok-if-already-exists)
   "Like `make-symbolic-link' for tramp files.
-This function will raise an error if FILENAME and LINKNAME are not
-on the same remote host."
-  (unless (or (tramp-tramp-file-p filename)
-              (tramp-tramp-file-p linkname))
-    (tramp-run-real-handler 'make-symbolic-link
-			    (list filename linkname ok-if-already-exists)))
-  (let* ((file	 (tramp-dissect-file-name 	filename))
-	 (link   (tramp-dissect-file-name 	linkname))
-	 (multi	 (tramp-file-name-multi-method	file))
-	 (method (tramp-file-name-method	file))
-	 (user   (tramp-file-name-user		file))
-	 (host   (tramp-file-name-host		file))
-         (l-multi (tramp-file-name-multi-method link))
-         (l-meth  (tramp-file-name-method       link))
-         (l-user  (tramp-file-name-user         link))
-         (l-host  (tramp-file-name-host         link))
-	 (ln	 (tramp-get-remote-ln 		multi method user host))
-	 (cwd	 (file-name-directory		(tramp-file-name-path file))))
-    (unless ln
-      (signal 'file-error (list "Making a symbolic link."
-				"ln(1) does not exist on the remote host.")))
-
-    ;; Check that method, user, host are the same.
-    (unless (equal host l-host)
-      (signal 'file-error (list "Can't make symlink across hosts" host l-host)))
-    (unless (equal user l-user)
-      (signal 'file-error (list "Can't make symlink for different users"
-                                user l-user)))
-    (unless (and (equal multi l-multi)
-                 (equal method l-meth))
-      (signal 'file-error (list "Method must be the same for making symlinks"
-                                multi l-multi method l-meth)))
-
-    ;; Do the 'confirm if exists' thing.
-    (when (file-exists-p (tramp-file-name-path link))
-      ;; What to do?
-      (if (or (null ok-if-already-exists) ; not allowed to exist
-	      (and (numberp ok-if-already-exists)
-		   (not (yes-or-no-p
-			 (format "File %s already exists; make it a link anyway? "
-				 (tramp-file-name-path link))))))
-	  (signal 'file-already-exists (list "File already exists"
-					     (tramp-file-name-path link)))))
+If LINKNAME is a non-Tramp file, it is used verbatim as the target of
+the symlink.  If LINKNAME is a Tramp file, only the path component is
+used as the target of the symlink.
+
+If LINKNAME is a Tramp file and the path component is relative, then
+it is expanded first, before the path component is taken.  Note that
+this can give surprising results if the user/host for the source and
+target of the symlink differ."
+  (with-parsed-tramp-file-name linkname l
+    (when (tramp-ange-ftp-file-name-p l-multi-method l-method)
+      (tramp-invoke-ange-ftp 'make-symbolic-link
+			     filename linkname ok-if-already-exists))
+    (let ((ln (tramp-get-remote-ln l-multi-method l-method l-user l-host))
+	  (cwd (file-name-directory l-path)))
+      (unless ln
+	(signal 'file-error
+		(list "Making a symbolic link."
+		      "ln(1) does not exist on the remote host.")))
+
+      ;; Do the 'confirm if exists' thing.
+      (when (file-exists-p linkname)
+	;; What to do?
+	(if (or (null ok-if-already-exists) ; not allowed to exist
+		(and (numberp ok-if-already-exists)
+		     (not (yes-or-no-p
+			   (format
+			    "File %s already exists; make it a link anyway? "
+			    l-path)))))
+	    (signal 'file-already-exists (list "File already exists" l-path))
+	  (delete-file linkname)))
+
+      ;; If FILENAME is a Tramp name, use just the path component.
+      (when (tramp-tramp-file-p filename)
+	(setq filename (tramp-file-name-path
+			(tramp-dissect-file-name
+			 (expand-file-name filename)))))
     
-    ;; Right, they are on the same host, regardless of user, method, etc.
-    ;; We now make the link on the remote machine. This will occur as the user
-    ;; that FILENAME belongs to.
-    (zerop
-     (tramp-send-command-and-check
-      multi method user host
-      (format "cd %s && %s -sf %s %s"
-              cwd ln
-              (tramp-file-name-path file) ; target
-              (tramp-file-name-path link)) ; link name
-      t))))				
+      ;; Right, they are on the same host, regardless of user, method, etc.
+      ;; We now make the link on the remote machine. This will occur as the user
+      ;; that FILENAME belongs to.
+      (zerop
+       (tramp-send-command-and-check
+	l-multi-method l-method l-user l-host
+	(format "cd %s && %s -sf %s %s"
+		cwd ln
+		filename 
+		l-path)
+	t)))))
 
 
 (defun tramp-handle-load (file &optional noerror nomessage nosuffix must-suffix)
   "Like `load' for tramp files.  Not implemented!"
   (unless (file-name-absolute-p file)
     (error "Tramp cannot `load' files without absolute path name"))
-  (unless nosuffix
-    (cond ((file-exists-p (concat file ".elc"))
-           (setq file (concat file ".elc")))
-          ((file-exists-p (concat file ".el"))
-           (setq file (concat file ".el")))))
-  (when must-suffix
-    ;; The first condition is always true for absolute file names.
-    ;; Included for safety's sake.
-    (unless (or (file-name-directory file)
-                (string-match "\\.elc?\\'" file))
-      (error "File `%s' does not include a `.el' or `.elc' suffix"
-             file)))
-  (unless noerror
-    (when (not (file-exists-p file))
-      (error "Cannot load nonexistant file `%s'" file)))
-  (if (not (file-exists-p file))
-      nil
-    (unless nomessage
-      (message "Loading %s..." file))
-    (let ((local-copy (file-local-copy file)))
-      ;; MUST-SUFFIX doesn't exist on XEmacs, so let it default to nil.
-      (load local-copy noerror t t)
-      (delete-file local-copy))
-    (unless nomessage
-      (message "Loading %s...done" file))
-    t))
+  (with-parsed-tramp-file-name file nil
+    (when (tramp-ange-ftp-file-name-p multi-method method)
+      (tramp-invoke-ange-ftp 'load
+			     file noerror nomessage nosuffix must-suffix))
+    (unless nosuffix
+      (cond ((file-exists-p (concat file ".elc"))
+	     (setq file (concat file ".elc")))
+	    ((file-exists-p (concat file ".el"))
+	     (setq file (concat file ".el")))))
+    (when must-suffix
+      ;; The first condition is always true for absolute file names.
+      ;; Included for safety's sake.
+      (unless (or (file-name-directory file)
+		  (string-match "\\.elc?\\'" file))
+	(error "File `%s' does not include a `.el' or `.elc' suffix"
+	       file)))
+    (unless noerror
+      (when (not (file-exists-p file))
+	(error "Cannot load nonexistant file `%s'" file)))
+    (if (not (file-exists-p file))
+	nil
+      (unless nomessage
+	(message "Loading %s..." file))
+      (let ((local-copy (file-local-copy file)))
+	;; MUST-SUFFIX doesn't exist on XEmacs, so let it default to nil.
+	(load local-copy noerror t t)
+	(delete-file local-copy))
+      (unless nomessage
+	(message "Loading %s...done" file))
+      t)))
 
 ;; Path manipulation functions that grok TRAMP paths...
 (defun tramp-handle-file-name-directory (file)
   "Like `file-name-directory' but aware of TRAMP files."
   ;; everything except the last filename thing is the directory
-  (let* ((v	 (tramp-dissect-file-name file))
-         (multi-method (tramp-file-name-multi-method v))
-	 (method (tramp-file-name-method v))
-	 (user   (tramp-file-name-user v))
-	 (host   (tramp-file-name-host v))
-	 (path   (tramp-file-name-path v)))
-    (if (or (string= path "") (string= path "/"))
+  (with-parsed-tramp-file-name file nil
+    (when (tramp-ange-ftp-file-name-p multi-method method)
+      (tramp-invoke-ange-ftp 'file-name-directory file))
+    ;; For the following condition, two possibilities should be tried:
+    ;; (1) (string= path "")
+    ;; (2) (or (string= path "") (string= path "/"))
+    ;; The second variant fails when completing a "/" directory on
+    ;; the remote host, that is a filename which looks like
+    ;; "/user@host:/".  But maybe wildcards fail with the first variant.
+    ;; We should do some investigation.
+    (if (string= path "")
 	;; For a filename like "/[foo]", we return "/".  The `else'
 	;; case would return "/[foo]" unchanged.  But if we do that,
 	;; then `file-expand-wildcards' ceases to work.  It's not
 
 (defun tramp-handle-file-name-nondirectory (file)
   "Like `file-name-nondirectory' but aware of TRAMP files."
-  (let ((v (tramp-dissect-file-name file)))
-    (file-name-nondirectory (tramp-file-name-path v))))
+  (with-parsed-tramp-file-name file nil
+    (when (tramp-ange-ftp-file-name-p multi-method method)
+      (tramp-invoke-ange-ftp 'file-name-nondirectory file))
+    (file-name-nondirectory path)))
 
 (defun tramp-handle-file-truename (filename &optional counter prev-dirs)
   "Like `file-truename' for tramp files."
-  (let* ((v (tramp-dissect-file-name (tramp-handle-expand-file-name filename)))
-	 (multi-method (tramp-file-name-multi-method v))
-	 (method       (tramp-file-name-method v))
-	 (user         (tramp-file-name-user v))
-	 (host         (tramp-file-name-host v))
-	 (path         (tramp-file-name-path v))
-	 (steps        (tramp-split-string path "/"))
-	 (pathdir (let ((directory-sep-char ?/))
-		    (file-name-as-directory path)))
-	 (is-dir (string= path pathdir))
-	 (thisstep nil)
-	 (numchase 0)
-	 (numchase-limit 100)
-	 (result       nil)		;result steps in reverse order
-	 (curstri "")
-	 symlink-target)
-    (tramp-message-for-buffer
-     multi-method method user host
-     10 "Finding true name for `%s'" filename)
-    (while (and steps (< numchase numchase-limit))
-      (setq thisstep (pop steps))
+  (with-parsed-tramp-file-name filename nil
+    ;; Ange-FTP does not support truename processing, but for
+    ;; convenience we pretend it did and forward the call to Ange-FTP
+    ;; anyway.  Ange-FTP then just invokes `identity'.
+    (when (tramp-ange-ftp-file-name-p multi-method method)
+      (tramp-invoke-ange-ftp 'file-truename filename))
+    (let* ((steps        (tramp-split-string path "/"))
+	   (pathdir (let ((directory-sep-char ?/))
+		      (file-name-as-directory path)))
+	   (is-dir (string= path pathdir))
+	   (thisstep nil)
+	   (numchase 0)
+	   ;; Don't make the following value larger than necessary.
+	   ;; People expect an error message in a timely fashion when
+	   ;; something is wrong; otherwise they might think that Emacs
+	   ;; is hung.  Of course, correctness has to come first.
+	   (numchase-limit 20)
+	   (result nil)			;result steps in reverse order
+	   (curstri "")
+	   symlink-target)
       (tramp-message-for-buffer
        multi-method method user host
-       10 "Check %s"
-       (mapconcat 'identity
-		  (append '("") (reverse result) (list thisstep))
-		  "/"))
-      (setq symlink-target
-	    (nth 0 (tramp-handle-file-attributes
-		    (tramp-make-tramp-file-name
-		     multi-method method user host
-		     (mapconcat 'identity
-				(append '("") (reverse result) (list thisstep))
-				"/")))))
-      (cond ((string= "." thisstep)
-	     (tramp-message-for-buffer multi-method method user host
-				       10 "Ignoring step `.'"))
-	    ((string= ".." thisstep)
-	     (tramp-message-for-buffer multi-method method user host
-				       10 "Processing step `..'")
-	     (pop result))
-	    ((stringp symlink-target)
-	     ;; It's a symlink, follow it.
-	     (tramp-message-for-buffer
-	      multi-method method user host
-	      10 "Follow symlink to %s" symlink-target)
-	     (setq numchase (1+ numchase))
-	     (when (file-name-absolute-p symlink-target)
-	       (setq result nil))
-	     (setq steps
-		   (append (tramp-split-string symlink-target "/") steps)))
-	    (t
-	     ;; It's a file.
-	     (setq result (cons thisstep result)))))
-    (when (>= numchase numchase-limit)
-      (error "Maximum number (%d) of symlinks exceeded" numchase-limit))
-    (setq result (reverse result))
-    (tramp-message-for-buffer
-     multi-method method user host
-     10 "True name of `%s' is `%s'"
-     filename (mapconcat 'identity (cons "" result) "/"))
-    (tramp-make-tramp-file-name
-     multi-method method user host
-     (concat (mapconcat 'identity (cons "" result) "/")
-	     (if is-dir "/" "")))))
+       10 "Finding true name for `%s'" filename)
+      (while (and steps (< numchase numchase-limit))
+	(setq thisstep (pop steps))
+	(tramp-message-for-buffer
+	 multi-method method user host
+	 10 "Check %s"
+	 (mapconcat 'identity
+		    (append '("") (reverse result) (list thisstep))
+		    "/"))
+	(setq symlink-target
+	      (nth 0 (tramp-handle-file-attributes
+		      (tramp-make-tramp-file-name
+		       multi-method method user host
+		       (mapconcat 'identity
+				  (append '("")
+					  (reverse result)
+					  (list thisstep))
+				  "/")))))
+	(cond ((string= "." thisstep)
+	       (tramp-message-for-buffer multi-method method user host
+					 10 "Ignoring step `.'"))
+	      ((string= ".." thisstep)
+	       (tramp-message-for-buffer multi-method method user host
+					 10 "Processing step `..'")
+	       (pop result))
+	      ((stringp symlink-target)
+	       ;; It's a symlink, follow it.
+	       (tramp-message-for-buffer
+		multi-method method user host
+		10 "Follow symlink to %s" symlink-target)
+	       (setq numchase (1+ numchase))
+	       (when (file-name-absolute-p symlink-target)
+		 (setq result nil))
+	       (setq steps
+		     (append (tramp-split-string symlink-target "/") steps)))
+	      (t
+	       ;; It's a file.
+	       (setq result (cons thisstep result)))))
+      (when (>= numchase numchase-limit)
+	(error "Maximum number (%d) of symlinks exceeded" numchase-limit))
+      (setq result (reverse result))
+      (tramp-message-for-buffer
+       multi-method method user host
+       10 "True name of `%s' is `%s'"
+       filename (mapconcat 'identity (cons "" result) "/"))
+      (tramp-make-tramp-file-name
+       multi-method method user host
+       (concat (mapconcat 'identity (cons "" result) "/")
+	       (if is-dir "/" ""))))))
 
 ;; Basic functions.
 
 (defun tramp-handle-file-exists-p (filename)
   "Like `file-exists-p' for tramp files."
-  (let ((v (tramp-dissect-file-name (tramp-handle-expand-file-name filename)))
-        multi-method method user host path)
-    (setq multi-method (tramp-file-name-multi-method v))
-    (setq method (tramp-file-name-method v))
-    (setq user (tramp-file-name-user v))
-    (setq host (tramp-file-name-host v))
-    (setq path (tramp-file-name-path v))
+  (with-parsed-tramp-file-name filename nil
+    (when (tramp-ange-ftp-file-name-p multi-method method)
+      (tramp-invoke-ange-ftp 'file-exists-p filename))
     (save-excursion
       (zerop (tramp-send-command-and-check
 	      multi-method method user host
 	      (format
-               (tramp-get-file-exists-command multi-method method user host)
-               (tramp-shell-quote-argument path)))))))
+	       (tramp-get-file-exists-command multi-method method user host)
+	       (tramp-shell-quote-argument path)))))))
 
 ;; CCC: This should check for an error condition and signal failure
 ;;      when something goes wrong.
   "Like `file-attributes' for tramp files.
 Optional argument NONNUMERIC means return user and group name
 rather than as numbers."
-  (if (tramp-handle-file-exists-p filename)
-      ;; file exists, find out stuff
-      (save-excursion
-	(let* ((v (tramp-dissect-file-name (tramp-handle-expand-file-name filename)))
-	       (multi-method (tramp-file-name-multi-method v))
-	       (method (tramp-file-name-method v))
-	       (user (tramp-file-name-user v))
-	       (host (tramp-file-name-host v))
-	       (path (tramp-file-name-path v)))
+  (let (result)
+    (with-parsed-tramp-file-name filename nil
+      (when (tramp-ange-ftp-file-name-p multi-method method)
+	(tramp-invoke-ange-ftp 'file-attributes filename))
+      (when (tramp-handle-file-exists-p filename)
+	;; file exists, find out stuff
+	(save-excursion
 	  (if (tramp-get-remote-perl multi-method method user host)
-	      (tramp-handle-file-attributes-with-perl multi-method method user host path nonnumeric)
-	    (tramp-handle-file-attributes-with-ls multi-method method user host path nonnumeric))))
-    nil))				; no file
+	      (setq result
+		    (tramp-handle-file-attributes-with-perl
+		     multi-method method user host path nonnumeric))
+	    (setq result
+		  (tramp-handle-file-attributes-with-ls
+		   multi-method method user host path nonnumeric))))))
+    result))
 
 
 (defun tramp-handle-file-attributes-with-ls
   (let (symlinkp dirp
 		 res-inode res-filemodes res-numlinks
 		 res-uid res-gid res-size res-symlink-target)
+    (tramp-message-for-buffer multi-method method user host 10
+			      "file attributes with ls: %s"
+			      (tramp-make-tramp-file-name
+			       multi-method method user host path))
     (tramp-send-command
      multi-method method user host
      (format "%s %s %s"
 
 The Perl command is sent to the remote machine when the connection
 is initially created and is kept cached by the remote shell."
+  (tramp-message-for-buffer multi-method method user host 10
+			    "file attributes with perl: %s"
+			    (tramp-make-tramp-file-name
+			     multi-method method user host path))
   (tramp-send-command
    multi-method method user host
    (format "tramp_file_attributes %s" 
 	   (buffer-name)))
   (when time-list
     (tramp-run-real-handler 'set-visited-file-modtime (list time-list)))
-  (let* ((coding-system-used nil)
-	 (f (buffer-file-name))
-	 (v (tramp-dissect-file-name f))
-	 (multi-method (tramp-file-name-multi-method v))
-	 (method (tramp-file-name-method v))
-	 (user (tramp-file-name-user v))
-	 (host (tramp-file-name-host v))
-	 (path (tramp-file-name-path v))
-	 (attr (file-attributes f))
-	 (modtime (nth 5 attr)))
-    ;; We use '(0 0) as a don't-know value.  See also
-    ;; `tramp-handle-file-attributes-with-ls'.
-    (when (boundp 'last-coding-system-used)
-      (setq coding-system-used last-coding-system-used))
-    (if (not (equal modtime '(0 0)))
-	(tramp-run-real-handler 'set-visited-file-modtime (list modtime))
-      (save-excursion
-	(tramp-send-command
-	 multi-method method user host
-	 (format "%s -ild %s"
-		 (tramp-get-ls-command multi-method method user host)
-		 (tramp-shell-quote-argument path)))
-	(tramp-wait-for-output)
-	(setq attr (buffer-substring (point)
-				     (progn (end-of-line) (point)))))
-      (setq tramp-buffer-file-attributes attr))
-    (when (boundp 'last-coding-system-used)
-      (setq last-coding-system-used coding-system-used))
-    nil))
-
-;; This function makes the same assumption as
-;; `tramp-handle-set-visited-file-modtime'.
-(defun tramp-handle-verify-visited-file-modtime (buf)
-  "Like `verify-visited-file-modtime' for tramp files."
-  (with-current-buffer buf
-    (let* ((f (buffer-file-name))
-	   (v (tramp-dissect-file-name f))
-	   (multi-method (tramp-file-name-multi-method v))
-	   (method (tramp-file-name-method v))
-	   (user (tramp-file-name-user v))
-	   (host (tramp-file-name-host v))
-	   (path (tramp-file-name-path v))
-	   (attr (file-attributes f))
-	   (modtime (nth 5 attr)))
-      (if attr
+  (let ((f (buffer-file-name))
+	(coding-system-used nil))
+    (with-parsed-tramp-file-name f nil
+      ;; This operation is not handled by Ange-FTP!  Compare this
+      ;; behavior with `file-truename' which Ange-FTP does not really
+      ;; handle, either, but at least it pretends to.  I wonder if
+      ;; Ange-FTP should also pretend to grok
+      ;; `set-visited-file-modtime', for consistency?
+      (when (tramp-ange-ftp-file-name-p multi-method method)
+	(throw 'tramp-forward-to-ange-ftp
+	       (tramp-run-real-handler 'set-visited-file-modtime
+				       (list time-list))))
+      (let* ((attr (file-attributes f))
+	     (modtime (nth 5 attr)))
+	;; We use '(0 0) as a don't-know value.  See also
+	;; `tramp-handle-file-attributes-with-ls'.
+	(when (boundp 'last-coding-system-used)
+	  (setq coding-system-used last-coding-system-used))
 	(if (not (equal modtime '(0 0)))
-	    ;; Why does `file-attributes' return a list (HIGH LOW), but
-	    ;; `visited-file-modtime' returns a cons (HIGH . LOW)?
-	    (let ((mt (visited-file-modtime)))
-	      (< (abs (tramp-time-diff modtime (list (car mt) (cdr mt)))) 2))
+	    (tramp-run-real-handler 'set-visited-file-modtime (list modtime))
 	  (save-excursion
 	    (tramp-send-command
 	     multi-method method user host
 	    (tramp-wait-for-output)
 	    (setq attr (buffer-substring (point)
 					 (progn (end-of-line) (point)))))
-	  (equal tramp-buffer-file-attributes attr))
-	;; If file does not exist, say it is not modified.
+	  (setq tramp-buffer-file-attributes attr))
+	(when (boundp 'last-coding-system-used)
+	  (setq last-coding-system-used coding-system-used))
 	nil))))
 
+;; CCC continue here
+
+;; This function makes the same assumption as
+;; `tramp-handle-set-visited-file-modtime'.
+(defun tramp-handle-verify-visited-file-modtime (buf)
+  "Like `verify-visited-file-modtime' for tramp files."
+  (with-current-buffer buf
+    (let ((f (buffer-file-name)))
+      (with-parsed-tramp-file-name f nil
+	(when (tramp-ange-ftp-file-name-p multi-method method)
+	  ;; This one requires a hack since the file name is not passed
+	  ;; on the arg list.
+	  (let ((buffer-file-name (tramp-make-ange-ftp-file-name
+				   user host path)))
+	    (tramp-invoke-ange-ftp 'verify-visited-file-modtime buf)))
+	(let* ((attr (file-attributes f))
+	       (modtime (nth 5 attr)))
+	  (cond ((and attr (not (equal modtime '(0 0))))
+		 ;; Why does `file-attributes' return a list (HIGH
+		 ;; LOW), but `visited-file-modtime' returns a cons
+		 ;; (HIGH . LOW)?
+		 (let ((mt (visited-file-modtime)))
+		   (< (abs (tramp-time-diff
+			    modtime (list (car mt) (cdr mt)))) 2)))
+		(attr
+		 (save-excursion
+		   (tramp-send-command
+		    multi-method method user host
+		    (format "%s -ild %s"
+			    (tramp-get-ls-command multi-method method
+						  user host)
+			    (tramp-shell-quote-argument path)))
+		   (tramp-wait-for-output)
+		   (setq attr (buffer-substring
+			       (point) (progn (end-of-line) (point)))))
+		 (equal tramp-buffer-file-attributes attr))
+		;; If file does not exist, say it is not modified.
+		(t nil)))))))
+
 (defadvice clear-visited-file-modtime (after tramp activate)
   "Set `tramp-buffer-file-attributes' back to nil.
 Tramp uses this variable as an emulation for the actual modtime of the file,
 
 (defun tramp-handle-set-file-modes (filename mode)
   "Like `set-file-modes' for tramp files."
-  (let ((v (tramp-dissect-file-name filename)))
+  (with-parsed-tramp-file-name filename nil
+    (when (tramp-ange-ftp-file-name-p multi-method method)
+      (tramp-invoke-ange-ftp 'set-file-modes filename mode))
     (save-excursion
       (unless (zerop (tramp-send-command-and-check
-                      (tramp-file-name-multi-method v)
-                      (tramp-file-name-method v)
-                      (tramp-file-name-user v)
-                      (tramp-file-name-host v)
-                      (format "chmod %s %s"
-                              (tramp-decimal-to-octal mode)
-                              (tramp-shell-quote-argument
-                               (tramp-file-name-path v)))))
+		      multi-method method user host
+		      (format "chmod %s %s"
+			      (tramp-decimal-to-octal mode)
+			      (tramp-shell-quote-argument path))))
 	(signal 'file-error
 		(list "Doing chmod"
 		      ;; FIXME: extract the proper text from chmod's stderr.
 
 (defun t