Function: vc-set-async-update

vc-set-async-update is a byte-compiled function defined in vc-dispatcher.el.gz.

Signature

(vc-set-async-update PROCESS-BUFFER)

Documentation

Set a vc-exec-after action appropriate to the current buffer.

This action will update the current buffer after the current asynchronous VC command has completed. PROCESS-BUFFER is the buffer for the asynchronous VC process.

If the current buffer is a VC Dir buffer, call vc-dir-refresh. If the current buffer is a Dired buffer, revert it. If the current buffer visits a file, call vc-refresh-state.

Source Code

;; Defined in /usr/src/emacs/lisp/vc/vc-dispatcher.el.gz
(defun vc-set-async-update (process-buffer)
  "Set a `vc-exec-after' action appropriate to the current buffer.
This action will update the current buffer after the current
asynchronous VC command has completed.  PROCESS-BUFFER is the
buffer for the asynchronous VC process.

If the current buffer is a VC Dir buffer, call `vc-dir-refresh'.
If the current buffer is a Dired buffer, revert it.
If the current buffer visits a file, call `vc-refresh-state'."
  (let* ((buf (current-buffer))
	 (tick (buffer-modified-tick buf)))
    (cl-macrolet ((run-delayed (&rest body)
                    `(with-current-buffer process-buffer
                       (vc-run-delayed
                         (when (buffer-live-p buf)
                           (with-current-buffer buf
                             ,@body))))))
      (cond ((derived-mode-p 'vc-dir-mode)
             (run-delayed (vc-dir-refresh)))
            ((derived-mode-p 'dired-mode)
             (run-delayed
              (when (= (buffer-modified-tick buf) tick)
                (revert-buffer))))
            (buffer-file-name
             (run-delayed (vc-refresh-state)))))))