Function: tramp-barf-if-file-missing
tramp-barf-if-file-missing is a macro defined in tramp.el.gz.
Signature
(tramp-barf-if-file-missing VEC FILENAME &rest BODY)
Documentation
Execute BODY and return the result.
In case of an error, raise a file-missing error if FILENAME
does not exist, otherwise propagate the error.
Source Code
;; Defined in /usr/src/emacs/lisp/net/tramp.el.gz
;; This macro shall optimize the cases where a `file-exists-p' call is
;; invoked first. Often, the file exists, so the remote command is
;; superfluous.
(defmacro tramp-barf-if-file-missing (vec filename &rest body)
"Execute BODY and return the result.
In case of an error, raise a `file-missing' error if FILENAME
does not exist, otherwise propagate the error."
(declare (indent 2) (debug (symbolp form body)))
(let ((err (make-symbol "err")))
`(condition-case ,err
(progn ,@body)
(error
(if (not (file-exists-p ,filename))
(tramp-error ,vec 'file-missing ,filename)
(signal (car ,err) (cdr ,err)))))))