Function: shadow-contract-file-name

shadow-contract-file-name is a byte-compiled function defined in shadowfile.el.gz.

Signature

(shadow-contract-file-name FILE)

Documentation

Simplify FILE.

Do so by replacing (when possible) home directory with ~/, and hostname with cluster name that includes it. Filename should be absolute and true.

Source Code

;; Defined in /usr/src/emacs/lisp/shadowfile.el.gz
(defun shadow-contract-file-name (file)
  "Simplify FILE.
Do so by replacing (when possible) home directory with ~/, and
hostname with cluster name that includes it.  Filename should be
absolute and true."
  (when-let* ((hup (shadow-parse-name file)))
    (let* ((homedir (if (shadow-local-file hup)
                        shadow-homedir
		      (file-name-as-directory
		       (file-local-name
                        (expand-file-name
                         (shadow-make-fullname hup nil shadow-homedir))))))
	   (suffix (shadow-suffix homedir (tramp-file-name-localname hup)))
	   (cluster (shadow-site-cluster (shadow-make-fullname hup nil ""))))
      (when cluster
        (setf (tramp-file-name-method hup) nil
	      (tramp-file-name-host hup) (shadow-cluster-name cluster)))
      (shadow-make-fullname
       hup nil
       (if suffix
           (concat shadow-homedir suffix)
         (tramp-file-name-localname hup))))))