Function: vc-resynch-window

vc-resynch-window is a byte-compiled function defined in vc-dispatcher.el.gz.

Signature

(vc-resynch-window FILE &optional KEEP NOQUERY RESET-VC-INFO)

Documentation

If FILE is in the current buffer, either revert or unvisit it.

The choice between revert (to see expanded keywords) and unvisit depends on KEEP. NOQUERY if non-nil inhibits confirmation for reverting. NOQUERY should be t *only* if it is known the only difference between the buffer and the file is due to modifications by the dispatcher client code, rather than user editing!

Source Code

;; Defined in /usr/src/emacs/lisp/vc/vc-dispatcher.el.gz
(defun vc-resynch-window (file &optional keep noquery reset-vc-info)
  "If FILE is in the current buffer, either revert or unvisit it.
The choice between revert (to see expanded keywords) and unvisit
depends on KEEP.  NOQUERY if non-nil inhibits confirmation for
reverting.  NOQUERY should be t *only* if it is known the only
difference between the buffer and the file is due to
modifications by the dispatcher client code, rather than user
editing!"
  (and (equal buffer-file-name
              (if (file-name-absolute-p file)
                  file
                (expand-file-name file (vc-root-dir))))
       (cond ((not keep)
              (kill-buffer))
             ((file-exists-p file)
              (when reset-vc-info
                (vc-file-clearprops file))
              (vc-revert-buffer-internal t noquery)

	      ;; VC operations might toggle the read-only state.  In
	      ;; that case we need to adjust the `view-mode' status
	      ;; when `view-read-only' is non-nil.
              (and view-read-only
                   (if (file-writable-p file)
                       (and view-mode
                            (let ((view-old-buffer-read-only nil))
                              (view-mode-exit t)))
                     (and (not view-mode)
                          (not (eq (get major-mode 'mode-class) 'special))
                          (view-mode-enter))))

              ;; FIXME: Why use a hook?  Why pass it buffer-file-name?
	      (run-hook-with-args 'vc-mode-line-hook buffer-file-name)))))