Function: tramp-file-name-unify

tramp-file-name-unify is an autoloaded and byte-compiled function defined in tramp.el.gz.

Signature

(tramp-file-name-unify VEC &optional LOCALNAME)

Documentation

Unify VEC by removing localname and hop from tramp-file-name structure.

If LOCALNAME is an absolute file name, set it as localname. If LOCALNAME is a relative file name, return tramp-cache-undefined. Objects returned by this function compare equal if they refer to the same connection. Make a copy in order to avoid side effects.

Source Code

;; Defined in /usr/src/emacs/lisp/net/tramp.el.gz
;;;###tramp-autoload
(defun tramp-file-name-unify (vec &optional localname)
  "Unify VEC by removing localname and hop from `tramp-file-name' structure.
If LOCALNAME is an absolute file name, set it as localname.  If
LOCALNAME is a relative file name, return `tramp-cache-undefined'.
Objects returned by this function compare `equal' if they refer to the
same connection.  Make a copy in order to avoid side effects."
  (if (and (stringp localname)
	   (not (file-name-absolute-p localname)))
      (setq vec tramp-cache-undefined)
    (when (tramp-file-name-p vec)
      (setq vec (copy-tramp-file-name vec))
      (setf (tramp-file-name-localname vec)
	    (and (stringp localname)
		 (tramp-compat-file-name-unquote
		  (directory-file-name localname)))
	    (tramp-file-name-hop vec) nil))
    vec))