Function: shadow-expand-cluster-in-file-name

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

Signature

(shadow-expand-cluster-in-file-name FILE)

Documentation

If hostname part of FILE is a cluster, expand it to cluster's primary hostname.

Will return the name bare if it is a local file.

Source Code

;; Defined in /usr/src/emacs/lisp/shadowfile.el.gz
(defun shadow-expand-cluster-in-file-name (file)
  "If hostname part of FILE is a cluster, expand it to cluster's primary hostname.
Will return the name bare if it is a local file."
  (when (stringp file)
    (cond
     ;; Local file.
     ((shadow-local-file file))
     ;; Cluster name.
     ((string-match "^\\(/[^:/]+:\\)[^:]*$" file)
      (let ((primary
             (save-match-data
	       (shadow-cluster-primary
                (shadow-get-cluster
                 (shadow-site-name (match-string 1 file)))))))
	(if (not primary)
            file
          (setq file (replace-match primary nil nil file 1))
          (or (shadow-local-file file) file))))
     (t file))))