Function: vc-dir-refresh
vc-dir-refresh is an interactive and byte-compiled function defined in
vc-dir.el.gz.
Signature
(vc-dir-refresh)
Documentation
Refresh the contents of the *VC-Dir* buffer.
Throw an error if another update process is in progress.
Key Bindings
Source Code
;; Defined in /usr/src/emacs/lisp/vc/vc-dir.el.gz
(defun vc-dir-refresh ()
"Refresh the contents of the *VC-Dir* buffer.
Throw an error if another update process is in progress."
(interactive)
(if (vc-dir-busy)
(error "Another update process is in progress, cannot run two at a time")
(let ((def-dir default-directory)
(backend vc-dir-backend))
(when (and vc-dir-save-some-buffers-on-revert (not non-essential))
(vc-buffer-sync-fileset `(,vc-dir-backend (,def-dir)) t))
(vc-set-mode-line-busy-indicator)
;; Call the `dir-status' backend function.
;; `dir-status' is supposed to be asynchronous.
;; It should compute the results, and then call the function
;; passed as an argument in order to update the vc-dir buffer
;; with the results.
(vc-dir--set-vc-dir-process-buffer backend)
;; set the needs-update flag on all non-directory entries
(ewoc-map (lambda (info)
(unless (vc-dir-fileinfo->directory info)
(setf (vc-dir-fileinfo->needs-update info) t) nil))
vc-ewoc)
;; Bzr has serious locking problems, so setup the headers first (this is
;; mostly synchronous) rather than doing it while dir-status is running.
(vc-dir--set-header def-dir 'reset-footer)
(let ((buffer (current-buffer)))
(with-current-buffer vc-dir-process-buffer
(setq default-directory def-dir)
(erase-buffer)
(vc-call-backend
backend 'dir-status-files def-dir nil
(lambda (entries &optional more-to-come)
;; ENTRIES is a list of (FILE VC-STATE EXTRA) items.
;; If MORE-TO-COME is true, then more updates will come from
;; the asynchronous process.
(with-current-buffer buffer
(vc-dir-update entries buffer)
(unless more-to-come
(if-let* ((remaining
(ewoc-collect vc-ewoc
'vc-dir-fileinfo->needs-update)))
(vc-dir-refresh-files (mapcar #'vc-dir-fileinfo->name
remaining))
(setq mode-line-process nil)
(run-hooks 'vc-dir-refresh-hook)))))))))))