Function: tramp-make-tramp-file-name
tramp-make-tramp-file-name is an autoloaded and byte-compiled function
defined in tramp.el.gz.
Signature
(tramp-make-tramp-file-name VEC &optional LOCALNAME)
Documentation
Construct a Tramp file name from ARGS.
ARGS could have two different signatures. The first one is of type (VEC &optional LOCALNAME). 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.
The other signature exists for backward compatibility. It has the form (METHOD USER DOMAIN HOST PORT LOCALNAME &optional HOP).
Source Code
;; Defined in /usr/src/emacs/lisp/net/tramp.el.gz
;;;###tramp-autoload
(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).
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.
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 hop
;; Keep hop in file name for completion or when indicated.
(unless (or minibuffer-completing-file-name tramp-show-ad-hoc-proxies)
(setq hop nil))
;; Assure that the hops are in `tramp-default-proxies-alist'.
;; In tramp-archive.el, the slot `hop' is used for the archive
;; file name.
(unless (string-equal method tramp-archive-method)
(tramp-add-hops (car 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))))
;; Unless `tramp-syntax' is `simplified', we need a method.
(when (and (not (string-empty-p tramp-postfix-method-format))
(tramp-string-empty-or-nil-p method))
(signal 'wrong-type-argument (list #'stringp method)))
(concat tramp-prefix-format hop
(unless (string-empty-p tramp-postfix-method-format)
(concat method tramp-postfix-method-format))
user
(unless (tramp-string-empty-or-nil-p domain)
(concat tramp-prefix-domain-format domain))
(unless (tramp-string-empty-or-nil-p user)
tramp-postfix-user-format)
(when host
(if (string-match-p tramp-ipv6-regexp host)
(concat
tramp-prefix-ipv6-format host tramp-postfix-ipv6-format)
host))
(unless (tramp-string-empty-or-nil-p port)
(concat tramp-prefix-port-format port))
tramp-postfix-host-format
localname)))