Function: ediff-verify-file-buffer
ediff-verify-file-buffer is a byte-compiled function defined in
ediff-util.el.gz.
Signature
(ediff-verify-file-buffer &optional FILE-MAGIC)
Source Code
;; Defined in /usr/src/emacs/lisp/vc/ediff-util.el.gz
;; Make sure the current buffer (for a file) has the same contents as the
;; file on disk, and attempt to remedy the situation if not.
;; Signal an error if we can't make them the same, or the user doesn't want
;; to do what is necessary to make them the same.
;; Also, Ediff always offers to revert obsolete buffers, whether they
;; are modified or not.
(defun ediff-verify-file-buffer (&optional file-magic)
;; First check if the file has been modified since the buffer visited it.
(if (verify-visited-file-modtime (current-buffer))
(if (buffer-modified-p)
;; If buffer is not obsolete and is modified, offer to save
(if (yes-or-no-p
(format "Buffer %s has been modified. Save it in file %s?"
(buffer-name)
buffer-file-name))
(condition-case nil
(save-buffer)
(error
(beep)
(message "Couldn't save %s" buffer-file-name)))
(user-error "Buffer is out of sync for file %s" buffer-file-name))
;; If buffer is not obsolete and is not modified, do nothing
nil)
;; If buffer is obsolete, offer to revert
(if (yes-or-no-p
(format "File %s was modified since visited by buffer %s. REVERT file %s? "
buffer-file-name
(buffer-name)
buffer-file-name))
(progn
(if file-magic ;FIXME: Why?
(erase-buffer))
(revert-buffer t t))
(user-error "Buffer out of sync for file %s" buffer-file-name))))