Function: tramp-sh-handle-verify-visited-file-modtime
tramp-sh-handle-verify-visited-file-modtime is a byte-compiled
function defined in tramp-sh.el.gz.
Signature
(tramp-sh-handle-verify-visited-file-modtime &optional BUF)
Documentation
Like verify-visited-file-modtime for Tramp files.
At the time verify-visited-file-modtime calls this function, we
already know that the buffer is visiting a file and that
visited-file-modtime does not return 0. Do not call this
function directly, unless those two cases are already taken care
of.
Source Code
;; Defined in /usr/src/emacs/lisp/net/tramp-sh.el.gz
;; This function makes the same assumption as
;; `tramp-sh-handle-set-visited-file-modtime'.
(defun tramp-sh-handle-verify-visited-file-modtime (&optional buf)
"Like `verify-visited-file-modtime' for Tramp files.
At the time `verify-visited-file-modtime' calls this function, we
already know that the buffer is visiting a file and that
`visited-file-modtime' does not return 0. Do not call this
function directly, unless those two cases are already taken care
of."
(with-current-buffer (or buf (current-buffer))
(let ((f (buffer-file-name)))
;; There is no file visiting the buffer, or the buffer has no
;; recorded last modification time, or there is no established
;; connection.
(if (or (not f)
(zerop (float-time (visited-file-modtime)))
(not (file-remote-p f nil 'connected)))
t
(with-parsed-tramp-file-name f nil
(let* ((remote-file-name-inhibit-cache t)
(attr (file-attributes f))
(modtime (file-attribute-modification-time attr))
(mt (visited-file-modtime)))
(cond
;; File exists, and has a known modtime.
((and attr (not (time-equal-p modtime tramp-time-dont-know)))
(< (abs (tramp-time-diff modtime mt)) 2))
;; Modtime has the don't know value.
(attr
(tramp-send-command
v
(format "%s -ild %s"
(tramp-get-ls-command v)
(tramp-shell-quote-argument localname)))
(with-current-buffer (tramp-get-buffer v)
(setq attr (buffer-substring (point) (line-end-position))))
(equal
attr
(tramp-get-file-property
v localname "visited-file-modtime-ild" "")))
;; If file does not exist, say it is not modified if and
;; only if that agrees with the buffer's record.
(t (time-equal-p mt tramp-time-doesnt-exist)))))))))