Function: shadow-local-file

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

Signature

(shadow-local-file FILE)

Documentation

If FILE is not remote, return it.

If it refers to a different system, return nil.

Source Code

;; Defined in /usr/src/emacs/lisp/shadowfile.el.gz
(defun shadow-local-file (file)
  "If FILE is not remote, return it.
If it refers to a different system, return nil."
  (cond
   ((null file) nil)
   ;; `tramp-file-name' structure.
   ((and (tramp-file-name-p file) (null (tramp-file-name-method file)))
    (tramp-file-name-localname file))
   ((tramp-file-name-p file) nil)
   ;; Local host name.
   ((string-match
     (format "^%s\\([^:]*\\)$" (regexp-quote shadow-system-name)) file)
    (match-string 1 file))
   ;; Cluster name.
   ((and (string-match "^/\\([^:/]+\\):\\([^:]*\\)$" file)
         (shadow-get-cluster (match-string 1 file)))
    (let ((file (match-string 2 file))
	  (primary
	   (shadow-cluster-primary
	    (shadow-get-cluster (match-string 1 file)))))
      (when (string-equal primary shadow-system-name) (setq primary nil))
      (shadow-local-file (concat primary file))))
   ;; Local name.
   ((null (file-remote-p file)) file)))