Commit 34bedf5d authored by Michael Albinus's avatar Michael Albinus

Sync with Tramp 2.4.0-pre

* doc/misc/trampver.texi:
* lisp/net/trampver.el: Change version to "2.4.0-pre".

* lisp/net/tramp-adb.el (tramp-adb-file-name-handler-alist):
Use `tramp-handle-file-directory-p'.
(tramp-adb-parse-device-names)
(tramp-adb-handle-expand-file-name)
(tramp-adb-handle-file-truename, tramp-adb-handle-process-file):
Adapt `tramp-make-tramp-file-name' call.
(tramp-adb-handle-file-directory-p): Remove.
(tramp-adb-maybe-open-connection): Do not set
tramp-current-*.

* lisp/net/tramp-cache.el (tramp-get-hash-table):
Adapt `tramp-make-tramp-file-name' call.

* lisp/net/tramp-cmds.el (tramp-cleanup-connection): Do not set
tramp-current-*.

* lisp/net/tramp-gvfs.el (tramp-gvfs-file-name-handler-alist):
Use `tramp-handle-file-directory-p'.
(tramp-gvfs-dbus-event-error): Trace with verbosity 6.
(tramp-gvfs-do-copy-or-rename-file): Use `file-truename'.
(tramp-gvfs-handle-file-directory-p): Remove.
(tramp-gvfs-handler-askpassword): Do not set tramp-current-*.

* lisp/net/tramp-sh.el (tramp-do-copy-or-rename-file-out-of-band)
(tramp-sh-handle-start-file-process)
(tramp-maybe-open-connection, tramp-get-remote-path): Do not
set tramp-current-*.
(tramp-maybe-open-connection): Set "password-vector" property.

* lisp/net/tramp-smb.el (tramp-smb-file-name-handler-alist):
Use `tramp-handle-file-accessible-directory-p' and
`tramp-handle-file-directory-p'.
(tramp-smb-handle-copy-directory, tramp-smb-handle-file-acl)
(tramp-smb-handle-set-file-acl)
(tramp-smb-maybe-open-connection): Do not set tramp-current-*.
(tramp-smb-handle-file-directory-p): Remove.
(tramp-smb-handle-make-symbolic-link):
Use `tramp-get-connection-buffer' rather than `buffer-name'.

* lisp/net/tramp.el (tramp-current-method, tramp-current-user)
(tramp-current-domain, tramp-current-host)
(tramp-current-port): Remove.
(tramp-dissect-file-name): No special handling of localname anymore.
(tramp-make-tramp-file-name): Reimplemnt with new signature.
(tramp-completion-make-tramp-file-name): Fix docstring.
(tramp-get-buffer, tramp-handle-file-name-as-directory)
(tramp-handle-file-name-directory)
(tramp-check-cached-permissions, tramp-local-host-p)
(tramp-get-remote-tmpdir, tramp-clear-passwd):
Adapt `tramp-make-tramp-file-name' call.
(tramp-completion-handle-file-name-all-completions)
(tramp-action-login, tramp-read-passwd): Do not set
tramp-current-*.
(tramp-handle-file-directory-p): New defun.
(tramp-handle-verify-visited-file-modtime): Remove superfluous
`with-parsed-tramp-file-name'.
(tramp-process-actions, tramp-read-passwd):
Use "password-vector" property.
(tramp-call-process, tramp-call-process-region): No special
setting of vec.
(tramp-read-passwd): Handle "login-as" property.

* test/lisp/net/tramp-tests.el (tramp-test21-file-links):
Special code for "smb".
parent b067fa1f
......@@ -8,7 +8,7 @@
@c In the Tramp GIT, the version number is auto-frobbed from
@c configure.ac, so you should edit that file and run
@c "autoconf && ./configure" to change the version number.
@set trampver 2.3.3-pre
@set trampver 2.4.0-pre
@c Other flags from configuration
@set instprefix /usr/local
......
......@@ -114,7 +114,7 @@ It is used for TCP/IP devices."
(file-accessible-directory-p . tramp-handle-file-accessible-directory-p)
(file-acl . ignore)
(file-attributes . tramp-adb-handle-file-attributes)
(file-directory-p . tramp-adb-handle-file-directory-p)
(file-directory-p . tramp-handle-file-directory-p)
(file-equal-p . tramp-handle-file-equal-p)
;; FIXME: This is too sloppy.
(file-executable-p . tramp-handle-file-exists-p)
......@@ -199,11 +199,13 @@ pass to the OPERATION."
(with-temp-buffer
;; `call-process' does not react on timer under MS Windows.
;; That's why we use `start-process'.
;; We don't know yet whether we need a user or host name for the
;; connection vector. We assume we don't, it will be OK in most
;; of the cases. Otherwise, there might be an additional trace
;; buffer, which doesn't hurt.
(let ((p (start-process
tramp-adb-program (current-buffer) tramp-adb-program "devices"))
(v (make-tramp-file-name
:method tramp-adb-method :user tramp-current-user
:host tramp-current-host))
(v (make-tramp-file-name :method tramp-adb-method))
result)
(tramp-message v 6 "%s" (mapconcat 'identity (process-command p) " "))
(process-put p 'adjust-window-size-function 'ignore)
......@@ -245,16 +247,8 @@ pass to the OPERATION."
;; be problems with UNC shares or Cygwin mounts.
(let ((default-directory (tramp-compat-temporary-file-directory)))
(tramp-make-tramp-file-name
method user domain host port
(tramp-drop-volume-letter
(tramp-run-real-handler
'expand-file-name (list localname))))))))
(defun tramp-adb-handle-file-directory-p (filename)
"Like `file-directory-p' for Tramp files."
(eq (tramp-compat-file-attribute-type
(file-attributes (file-truename filename)))
t))
v (tramp-drop-volume-letter
(tramp-run-real-handler 'expand-file-name (list localname))))))))
(defun tramp-adb-handle-file-system-info (filename)
"Like `file-system-info' for Tramp files."
......@@ -288,7 +282,7 @@ pass to the OPERATION."
"%s%s"
(with-parsed-tramp-file-name (expand-file-name filename) nil
(tramp-make-tramp-file-name
method user domain host port
v
(with-tramp-file-property v localname "file-truename"
(let ((result nil)) ; result steps in reverse order
(tramp-message v 4 "Finding true name for `%s'" filename)
......@@ -316,12 +310,10 @@ pass to the OPERATION."
(tramp-compat-file-attribute-type
(file-attributes
(tramp-make-tramp-file-name
method user domain host port
(mapconcat 'identity
(append '("")
(reverse result)
(list thisstep))
"/")))))
v (mapconcat 'identity
(append
'("") (reverse result) (list thisstep))
"/")))))
(cond ((string= "." thisstep)
(tramp-message v 5 "Ignoring step `.'"))
((string= ".." thisstep)
......@@ -861,8 +853,7 @@ PRESERVE-UID-GID and PRESERVE-EXTENDED-ATTRIBUTES are completely ignored."
(setq input (with-parsed-tramp-file-name infile nil localname))
;; INFILE must be copied to remote host.
(setq input (tramp-make-tramp-temp-file v)
tmpinput (tramp-make-tramp-file-name
method user domain host port input))
tmpinput (tramp-make-tramp-file-name v input))
(copy-file infile tmpinput t)))
(when input (setq command (format "%s <%s" command input)))
......@@ -895,8 +886,7 @@ PRESERVE-UID-GID and PRESERVE-EXTENDED-ATTRIBUTES are completely ignored."
;; stderr must be copied to remote host. The temporary
;; file must be deleted after execution.
(setq stderr (tramp-make-tramp-temp-file v)
tmpstderr (tramp-make-tramp-file-name
method user domain host port stderr))))
tmpstderr (tramp-make-tramp-file-name v stderr))))
;; stderr to be discarded.
((null (cadr destination))
(setq stderr "/dev/null"))))
......@@ -1252,10 +1242,6 @@ connection if a previous connection has died for some reason."
(user (tramp-file-name-user vec))
(device (tramp-adb-get-device vec)))
;; Set variables for proper tracing in `tramp-adb-parse-device-names'.
(setq tramp-current-user (tramp-file-name-user vec)
tramp-current-host (tramp-file-name-host vec))
;; Maybe we know already that "su" is not supported. We cannot
;; use a connection property, because we have not checked yet
;; whether it is still the same device.
......
......@@ -98,10 +98,7 @@ matching entries of `tramp-connection-properties'."
(dolist (elt tramp-connection-properties)
(when (string-match
(or (nth 0 elt) "")
(tramp-make-tramp-file-name
(tramp-file-name-method key) (tramp-file-name-user key)
(tramp-file-name-domain key) (tramp-file-name-host key)
(tramp-file-name-port key) nil))
(tramp-make-tramp-file-name key 'noloc 'nohop))
(tramp-set-connection-property key (nth 1 elt) (nth 2 elt)))))
hash)))
......
......@@ -80,16 +80,7 @@ When called interactively, a Tramp connection has to be selected."
;; Return nil when there is no Tramp connection.
(list
(let ((connections
(mapcar
(lambda (x)
(tramp-make-tramp-file-name
(tramp-file-name-method x)
(tramp-file-name-user x)
(tramp-file-name-domain x)
(tramp-file-name-host x)
(tramp-file-name-port x)
(tramp-file-name-localname x)))
(tramp-list-connections)))
(mapcar 'tramp-make-tramp-file-name (tramp-list-connections)))
name)
(when connections
......
......@@ -429,6 +429,7 @@ Every entry is a list (NAME ADDRESS).")
("gvfs-trash" . "trash"))
"List of cons cells, mapping \"gvfs-<command>\" to \"gio <command>\".")
;; <http://www.pygtk.org/docs/pygobject/gio-constants.html>
(defconst tramp-gvfs-file-attributes
'("name"
"type"
......@@ -495,7 +496,7 @@ Every entry is a list (NAME ADDRESS).")
(file-accessible-directory-p . tramp-handle-file-accessible-directory-p)
(file-acl . ignore)
(file-attributes . tramp-gvfs-handle-file-attributes)
(file-directory-p . tramp-gvfs-handle-file-directory-p)
(file-directory-p . tramp-handle-file-directory-p)
(file-equal-p . tramp-handle-file-equal-p)
(file-executable-p . tramp-gvfs-handle-file-executable-p)
(file-exists-p . tramp-handle-file-exists-p)
......@@ -642,7 +643,7 @@ is no information where to trace the message.")
(defun tramp-gvfs-dbus-event-error (event err)
"Called when a D-Bus error message arrives, see `dbus-event-error-functions'."
(when tramp-gvfs-dbus-event-vector
(tramp-message tramp-gvfs-dbus-event-vector 10 "%S" event)
(tramp-message tramp-gvfs-dbus-event-vector 6 "%S" event)
(tramp-error tramp-gvfs-dbus-event-vector 'file-error "%s" (cadr err))))
;; `dbus-event-error-hooks' has been renamed to
......@@ -675,6 +676,7 @@ file names."
(unless (memq op '(copy rename))
(error "Unknown operation `%s', must be `copy' or `rename'" op))
(setq filename (file-truename filename))
(if (file-directory-p filename)
(progn
(copy-directory filename newname keep-date t)
......@@ -1043,11 +1045,6 @@ If FILE-SYSTEM is non-nil, return file system attributes."
res-device
)))))
(defun tramp-gvfs-handle-file-directory-p (filename)
"Like `file-directory-p' for Tramp files."
(eq t (tramp-compat-file-attribute-type
(file-attributes (file-truename filename)))))
(defun tramp-gvfs-handle-file-executable-p (filename)
"Like `file-executable-p' for Tramp files."
(with-parsed-tramp-file-name filename nil
......@@ -1363,13 +1360,7 @@ ADDRESS can have the form \"xx:xx:xx:xx:xx:xx\" or \"[xx:xx:xx:xx:xx:xx]\"."
(unless (tramp-get-connection-property l "first-password-request" nil)
(tramp-clear-passwd l))
;; Set variables for computing the prompt for reading password.
(setq tramp-current-method l-method
tramp-current-user user
tramp-current-domain l-domain
tramp-current-host l-host
tramp-current-port l-port
password (tramp-read-passwd
(setq password (tramp-read-passwd
(tramp-get-connection-process l) pw-prompt))
;; Return result.
......
......@@ -2362,15 +2362,6 @@ The method used must be an out-of-band method."
(expand-file-name ".." tmpfile) 'recursive)
(delete-file tmpfile)))))
;; Set variables for computing the prompt for reading password.
(setq tramp-current-method (tramp-file-name-method v)
tramp-current-user (or (tramp-file-name-user v)
(tramp-get-connection-property
v "login-as" nil))
tramp-current-domain (tramp-file-name-domain v)
tramp-current-host (tramp-file-name-host v)
tramp-current-port (tramp-file-name-port v))
;; Check which ones of source and target are Tramp files.
(setq source (funcall
(if (and (file-directory-p filename)
......@@ -2866,13 +2857,7 @@ the result will be a local, non-Tramp, file name."
;; We discard hops, if existing, that's why we cannot use
;; `file-remote-p'.
(prompt (format "PS1=%s %s"
(tramp-make-tramp-file-name
(tramp-file-name-method v)
(tramp-file-name-user v)
(tramp-file-name-domain v)
(tramp-file-name-host v)
(tramp-file-name-port v)
(tramp-file-name-localname v))
(tramp-make-tramp-file-name v nil 'nohop)
tramp-initial-end-of-output))
;; We use as environment the difference to toplevel
;; `process-environment'.
......@@ -4755,8 +4740,7 @@ connection if a previous connection has died for some reason."
(set-process-sentinel p 'tramp-process-sentinel)
(process-put p 'adjust-window-size-function 'ignore)
(set-process-query-on-exit-flag p nil)
(setq tramp-current-connection (cons vec (current-time))
tramp-current-host (system-name))
(setq tramp-current-connection (cons vec (current-time)))
(tramp-message
vec 6 "%s" (mapconcat 'identity (process-command p) " "))
......@@ -4810,16 +4794,15 @@ connection if a previous connection has died for some reason."
;; Check, whether there is a restricted shell.
(dolist (elt tramp-restricted-shell-hosts-alist)
(when (string-match elt tramp-current-host)
(when (string-match elt l-host)
(setq r-shell t)))
;; Set variables for computing the prompt for
;; reading password.
(setq tramp-current-method l-method
tramp-current-user l-user
tramp-current-domain l-domain
tramp-current-host l-host
tramp-current-port l-port)
;; Set password prompt vector.
(tramp-set-connection-property
p "password-vector"
(make-tramp-file-name
:method l-method :user l-user :domain l-domain
:host l-host :port l-port))
;; Add login environment.
(when login-env
......@@ -5244,14 +5227,7 @@ Nonexistent directories are removed from spec."
(lambda (x)
(and
(stringp x)
(file-directory-p
(tramp-make-tramp-file-name
(tramp-file-name-method vec)
(tramp-file-name-user vec)
(tramp-file-name-domain vec)
(tramp-file-name-host vec)
(tramp-file-name-port vec)
x))
(file-directory-p (tramp-make-tramp-file-name vec x))
x))
remote-path)))))
......
......@@ -228,10 +228,10 @@ See `tramp-actions-before-shell' for more info.")
(dired-compress-file . ignore)
(dired-uncache . tramp-handle-dired-uncache)
(expand-file-name . tramp-smb-handle-expand-file-name)
(file-accessible-directory-p . tramp-smb-handle-file-directory-p)
(file-accessible-directory-p . tramp-handle-file-accessible-directory-p)
(file-acl . tramp-smb-handle-file-acl)
(file-attributes . tramp-smb-handle-file-attributes)
(file-directory-p . tramp-smb-handle-file-directory-p)
(file-directory-p . tramp-handle-file-directory-p)
(file-file-equal-p . tramp-handle-file-equal-p)
(file-executable-p . tramp-handle-file-exists-p)
(file-exists-p . tramp-handle-file-exists-p)
......@@ -449,13 +449,6 @@ pass to the OPERATION."
(if (not (file-directory-p newname))
(make-directory newname parents))
;; Set variables for computing the prompt for reading password.
(setq tramp-current-method method
tramp-current-user user
tramp-current-domain domain
tramp-current-host host
tramp-current-port port)
(let* ((share (tramp-smb-get-share v))
(localname (file-name-as-directory
(replace-regexp-in-string
......@@ -739,62 +732,56 @@ PRESERVE-UID-GID and PRESERVE-EXTENDED-ATTRIBUTES are completely ignored."
(defun tramp-smb-handle-file-acl (filename)
"Like `file-acl' for Tramp files."
(with-parsed-tramp-file-name filename nil
(with-tramp-file-property v localname "file-acl"
(when (executable-find tramp-smb-acl-program)
;; Set variables for computing the prompt for reading password.
(setq tramp-current-method method
tramp-current-user user
tramp-current-domain domain
tramp-current-host host
tramp-current-port port)
(let* ((share (tramp-smb-get-share v))
(localname (replace-regexp-in-string
"\\\\" "/" (tramp-smb-get-localname v)))
(args (list (concat "//" host "/" share) "-E")))
(if (not (zerop (length user)))
(setq args (append args (list "-U" user)))
(setq args (append args (list "-N"))))
(when domain (setq args (append args (list "-W" domain))))
(when port (setq args (append args (list "-p" port))))
(when tramp-smb-conf
(setq args (append args (list "-s" tramp-smb-conf))))
(setq
args
(append args (list (tramp-unquote-shell-quote-argument localname)
"2>/dev/null")))
(unwind-protect
(with-temp-buffer
;; Set the transfer process properties.
(tramp-set-connection-property
v "process-name" (buffer-name (current-buffer)))
(tramp-set-connection-property
v "process-buffer" (current-buffer))
;; Use an asynchronous processes. By this, password
;; can be handled.
(let ((p (apply
'start-process
(tramp-get-connection-name v)
(tramp-get-connection-buffer v)
tramp-smb-acl-program args)))
(tramp-message
v 6 "%s" (mapconcat 'identity (process-command p) " "))
(tramp-set-connection-property p "vector" v)
(process-put p 'adjust-window-size-function 'ignore)
(set-process-query-on-exit-flag p nil)
(tramp-process-actions p v nil tramp-smb-actions-get-acl)
(when (> (point-max) (point-min))
(substring-no-properties (buffer-string)))))
;; Reset the transfer process properties.
(tramp-set-connection-property v "process-name" nil)
(tramp-set-connection-property v "process-buffer" nil)))))))
(ignore-errors
(with-parsed-tramp-file-name filename nil
(with-tramp-file-property v localname "file-acl"
(when (executable-find tramp-smb-acl-program)
(let* ((share (tramp-smb-get-share v))
(localname (replace-regexp-in-string
"\\\\" "/" (tramp-smb-get-localname v)))
(args (list (concat "//" host "/" share) "-E")))
(if (not (zerop (length user)))
(setq args (append args (list "-U" user)))
(setq args (append args (list "-N"))))
(when domain (setq args (append args (list "-W" domain))))
(when port (setq args (append args (list "-p" port))))
(when tramp-smb-conf
(setq args (append args (list "-s" tramp-smb-conf))))
(setq
args
(append args (list (tramp-unquote-shell-quote-argument localname)
"2>/dev/null")))
(unwind-protect
(with-temp-buffer
;; Set the transfer process properties.
(tramp-set-connection-property
v "process-name" (buffer-name (current-buffer)))
(tramp-set-connection-property
v "process-buffer" (current-buffer))
;; Use an asynchronous process. By this, password can
;; be handled.
(let ((p (apply
'start-process
(tramp-get-connection-name v)
(tramp-get-connection-buffer v)
tramp-smb-acl-program args)))
(tramp-message
v 6 "%s" (mapconcat 'identity (process-command p) " "))
(tramp-set-connection-property p "vector" v)
(process-put p 'adjust-window-size-function 'ignore)
(set-process-query-on-exit-flag p nil)
(tramp-process-actions p v nil tramp-smb-actions-get-acl)
(when (> (point-max) (point-min))
(substring-no-properties (buffer-string)))))
;; Reset the transfer process properties.
(tramp-set-connection-property v "process-name" nil)
(tramp-set-connection-property v "process-buffer" nil))))))))
(defun tramp-smb-handle-file-attributes (filename &optional id-format)
"Like `file-attributes' for Tramp files."
......@@ -911,13 +898,6 @@ PRESERVE-UID-GID and PRESERVE-EXTENDED-ATTRIBUTES are completely ignored."
(list id link uid gid atime mtime ctime size mode nil inode
(tramp-get-device vec))))))))
(defun tramp-smb-handle-file-directory-p (filename)
"Like `file-directory-p' for Tramp files."
(and (file-exists-p filename)
(eq ?d
(aref (tramp-compat-file-attribute-modes (file-attributes filename))
0))))
(defun tramp-smb-handle-file-local-copy (filename)
"Like `file-local-copy' for Tramp files."
(with-parsed-tramp-file-name (file-truename filename) nil
......@@ -1222,7 +1202,7 @@ component is used as the target of the symlink."
(tramp-error
v 'file-error
"error with make-symbolic-link, see buffer `%s' for details"
(buffer-name)))))))
(tramp-get-connection-buffer v)))))))
(defun tramp-smb-handle-process-file
(program &optional infile destination display &rest args)
......@@ -1403,15 +1383,9 @@ component is used as the target of the symlink."
"Like `set-file-acl' for Tramp files."
(ignore-errors
(with-parsed-tramp-file-name filename nil
(when (and (stringp acl-string) (executable-find tramp-smb-acl-program))
;; Set variables for computing the prompt for reading password.
(setq tramp-current-method method
tramp-current-user user
tramp-current-domain domain
tramp-current-host host
tramp-current-port port)
(tramp-set-file-property v localname "file-acl" 'undef)
(tramp-set-file-property v localname "file-acl" 'undef)
(when (and (stringp acl-string) (executable-find tramp-smb-acl-program))
(let* ((share (tramp-smb-get-share v))
(localname (replace-regexp-in-string
"\\\\" "/" (tramp-smb-get-localname v)))
......@@ -1971,13 +1945,6 @@ If ARGUMENT is non-nil, use it as argument for
(process-put p 'adjust-window-size-function 'ignore)
(set-process-query-on-exit-flag p nil)
;; Set variables for computing the prompt for reading password.
(setq tramp-current-method tramp-smb-method
tramp-current-user user
tramp-current-domain domain
tramp-current-host host
tramp-current-port port)
(condition-case err
(let (tramp-message-show-message)
;; Play login scenario.
......
......@@ -1182,21 +1182,6 @@ means to use always cached values for the directory contents."
;;; Internal Variables:
(defvar tramp-current-method nil
"Connection method for this *tramp* buffer.")
(defvar tramp-current-user nil
"Remote login name for this *tramp* buffer.")
(defvar tramp-current-domain nil
"Remote domain name for this *tramp* buffer.")
(defvar tramp-current-host nil
"Remote host for this *tramp* buffer.")
(defvar tramp-current-port nil
"Remote port for this *tramp* buffer.")
(defvar tramp-current-connection nil
"Last connection timestamp.")
......@@ -1390,7 +1375,7 @@ values."
(make-tramp-file-name
:method method :user user :domain domain :host host :port port
:localname (or localname "") :hop hop)))))
:localname localname :hop hop)))))
(defun tramp-buffer-name (vec)
"A name for the connection buffer VEC."
......@@ -1401,30 +1386,64 @@ values."
(format "*tramp/%s %s@%s*" method user-domain host-port)
(format "*tramp/%s %s*" method host-port))))
(defun tramp-make-tramp-file-name
(method user domain host port localname &optional hop)
"Constructs a Tramp file name from METHOD, USER, HOST and LOCALNAME.
When not nil, optional DOMAIN, PORT and HOP are used."
(concat tramp-prefix-format hop
(unless (or (zerop (length method))
(zerop (length tramp-postfix-method-format)))
(concat method tramp-postfix-method-format))
user
(unless (zerop (length domain))
(concat tramp-prefix-domain-format domain))
(unless (zerop (length user))
tramp-postfix-user-format)
(when host
(if (string-match tramp-ipv6-regexp host)
(concat tramp-prefix-ipv6-format host tramp-postfix-ipv6-format)
host))
(unless (zerop (length port))
(concat tramp-prefix-port-format port))
tramp-postfix-host-format
(when localname localname)))
(defun tramp-make-tramp-file-name (&rest args)
"Construct a Tramp file name from ARGS.
ARGS could have two different signatures. The first one is of
type (VEC &optional LOCALNAME HOP).
If LOCALNAME is nil, the value in VEC is used. If it is a
symbol, a null localname will be used. Otherwise, LOCALNAME is
expected to be a string, which will be used.
If HOP is nil, the value in VEC is used. If it is a symbol, a
null hop will be used. Otherwise, HOP is expected to be a
string, which will be used.
The other signature exists for backward compatibility. It has
the form (METHOD USER DOMAIN HOST PORT LOCALNAME &optional HOP)."
(let (method user domain host port localname hop)
(cond
((tramp-file-name-p (car args))
(setq method (tramp-file-name-method (car args))
user (tramp-file-name-user (car args))
domain (tramp-file-name-domain (car args))
host (tramp-file-name-host (car args))
port (tramp-file-name-port (car args))
localname (tramp-file-name-localname (car args))
hop (tramp-file-name-hop (car args)))
(when (cadr args)
(setq localname (and (stringp (cadr args)) (cadr args))))
(when (cl-caddr args)
(setq hop (and (stringp (cl-caddr args)) (cl-caddr args)))))
(t (setq method (nth 0 args)
user (nth 1 args)
domain (nth 2 args)
host (nth 3 args)
port (nth 4 args)
localname (nth 5 args)
hop (nth 6 args))))
(concat tramp-prefix-format hop
(unless (or (zerop (length method))
(zerop (length tramp-postfix-method-format)))
(concat method tramp-postfix-method-format))
user
(unless (zerop (length domain))
(concat tramp-prefix-domain-format domain))
(unless (zerop (length user))
tramp-postfix-user-format)
(when host
(if (string-match tramp-ipv6-regexp host)
(concat
tramp-prefix-ipv6-format host tramp-postfix-ipv6-format)
host))
(unless (zerop (length port))
(concat tramp-prefix-port-format port))
tramp-postfix-host-format
localname)))
(defun tramp-completion-make-tramp-file-name (method user host localname)
"Constructs a Tramp file name from METHOD, USER, HOST and LOCALNAME.
"Construct a Tramp file name from METHOD, USER, HOST and LOCALNAME.
It must not be a complete Tramp file name, but as long as there are
necessary only. This function will be used in file name completion."
(concat tramp-prefix-format
......@@ -1451,15 +1470,8 @@ necessary only. This function will be used in file name completion."
(tramp-set-connection-property
vec "process-buffer"
(tramp-get-connection-property vec "process-buffer" nil))
(setq buffer-undo-list t)
(setq default-directory
(tramp-make-tramp-file-name
(tramp-file-name-method vec)
(tramp-file-name-user vec)
(tramp-file-name-domain vec)
(tramp-file-name-host vec)
(tramp-file-name-port vec)
"/"))
(setq buffer-undo-list t
default-directory (tramp-make-tramp-file-name vec "/" 'nohop))
(current-buffer))))
(defun tramp-get-connection-buffer (vec)
......@@ -2352,7 +2364,9 @@ remote file names."
(defun tramp-register-file-name-handlers ()
"Add Tramp file name handlers to `file-name-handler-alist'."
;; Remove autoloaded handlers from file name handler alist. Useful,
;; if `tramp-syntax' has been changed.
;; if `tramp-syntax' has been changed. We cannot call
;; `tramp-unload-file-name-handlers', this would result in recursive
;; loading of Tramp.
(dolist (fnh '(tramp-file-name-handler
tramp-completion-file-name-handler
tramp-autoload-file-name-handler))
......@@ -2488,7 +2502,6 @@ not in completion mode."
(host (tramp-file-name-host elt))
(localname (tramp-file-name-localname elt))
(m (tramp-find-method method user host))
(tramp-current-user user) ; see `tramp-parse-passwd'
all-user-hosts)
(unless localname ;; Nothing to complete.
......@@ -2978,6 +2991,12 @@ User is always nil."
(and (file-directory-p filename)
(file-readable-p filename)))
(defun tramp-handle-file-directory-p (filename)