Function: tramp-completion-make-tramp-file-name

tramp-completion-make-tramp-file-name is a byte-compiled function defined in tramp.el.gz.

Signature

(tramp-completion-make-tramp-file-name METHOD USER HOST LOCALNAME)

Documentation

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.

Source Code

;; Defined in /usr/src/emacs/lisp/net/tramp.el.gz
(defun tramp-completion-make-tramp-file-name (method user host 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
	  (unless (or (tramp-string-empty-or-nil-p method)
                      (string-empty-p tramp-postfix-method-format))
            (concat method tramp-postfix-method-format))
          (unless (tramp-string-empty-or-nil-p user)
	    (concat user tramp-postfix-user-format))
	  (unless (tramp-string-empty-or-nil-p host)
	    (concat
	     (cond
	      (;; ipv6#port -> [ipv6]#port
	       (string-match
		(rx (group (regexp tramp-ipv6-regexp))
		    (group (regexp tramp-prefix-port-regexp)
			   (regexp tramp-port-regexp)))
		host)
	       (concat
		tramp-prefix-ipv6-format (match-string 1 host)
		tramp-postfix-ipv6-format (match-string 2 host)))
	      (;; ipv6 -> [ipv6]
	       (string-match-p tramp-ipv6-regexp host)
	       (concat
		tramp-prefix-ipv6-format host tramp-postfix-ipv6-format))
	      (t host))
	     tramp-postfix-host-format))
	  localname))