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 VEC is nil, set it to tramp-null-hop. 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 VEC is nil, set it to `tramp-null-hop'.
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."
  ;; (declare (tramp-suppress-trace t))
  (if (and (stringp localname)
	   (not (file-name-absolute-p localname)))
      (setq vec tramp-cache-undefined)
    (unless vec (setq vec tramp-null-hop))
    (when (tramp-file-name-p vec)
      (setq vec (copy-tramp-file-name vec))
      (setf (tramp-file-name-localname vec)
	    (and (stringp localname)
		 (file-name-unquote (directory-file-name localname)))
	    (tramp-file-name-hop vec) nil))
    vec))