Function: tramp-skeleton-file-exists-p
tramp-skeleton-file-exists-p is a macro defined in tramp.el.gz.
Signature
(tramp-skeleton-file-exists-p FILENAME &rest BODY)
Documentation
Skeleton for tramp-*-handle-file-exists-p.
BODY is the backend specific code.
Source Code
;; Defined in /usr/src/emacs/lisp/net/tramp.el.gz
(defmacro tramp-skeleton-file-exists-p (filename &rest body)
"Skeleton for `tramp-*-handle-file-exists-p'.
BODY is the backend specific code."
(declare (indent 1) (debug t))
;; `file-exists-p' is used as predicate in file name completion.
`(or (and minibuffer-completing-file-name
(file-name-absolute-p ,filename)
(tramp-string-empty-or-nil-p
(tramp-file-name-localname (tramp-dissect-file-name ,filename))))
;; We don't want to run it when `non-essential' is t, or there
;; is no connection process yet.
(when (tramp-connectable-p ,filename)
(with-parsed-tramp-file-name (expand-file-name ,filename) nil
(with-tramp-file-property v localname "file-exists-p"
(cond
;; Examine `file-attributes' cache to see if request can
;; be satisfied without remote operation.
((and-let*
(((tramp-file-property-p v localname "file-attributes"))
(fa (tramp-get-file-property v localname "file-attributes"))
((not (stringp (car fa)))))))
;; Symlink to a non-existing target counts as nil.
;; Protect against cyclic symbolic links.
((file-symlink-p ,filename)
(ignore-errors
(file-exists-p (file-truename ,filename))))
(t ,@body)))))))