Function: tramp-handle-verify-visited-file-modtime

tramp-handle-verify-visited-file-modtime is a byte-compiled function defined in tramp.el.gz.

Signature

(tramp-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.el.gz
(defun tramp-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)
	      (eq (visited-file-modtime) 0)
	      (not (file-remote-p f nil 'connected)))
	  t
	(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 (tramp-compat-time-equal-p modtime tramp-time-dont-know)))
	    (< (abs (tramp-time-diff modtime mt)) 2))
	   ;; Modtime has the don't know value.
	   (attr t)
	   ;; If file does not exist, say it is not modified if and
	   ;; only if that agrees with the buffer's record.
	   (t (tramp-compat-time-equal-p mt tramp-time-doesnt-exist))))))))