Function: auto-revert-buffers

auto-revert-buffers is a byte-compiled function defined in autorevert.el.gz.

Signature

(auto-revert-buffers)

Documentation

Revert buffers as specified by Auto-Revert and Global Auto-Revert Mode.

Should global-auto-revert-mode(var)/global-auto-revert-mode(fun) be active all file buffers are checked.

Should auto-revert-mode(var)/auto-revert-mode(fun) be active in some buffers, those buffers are checked.

Non-file buffers that have a custom revert-buffer-function and buffer-stale-function are reverted either when Auto-Revert Mode is active in that buffer, or when the variable global-auto-revert-non-file-buffers is non-nil and Global Auto-Revert Mode is active.

This function stops whenever there is user input. The buffers not checked are stored in the variable auto-revert-remaining-buffers.

To avoid starvation, the buffers in auto-revert-remaining-buffers are checked first the next time this function is called.

This function is also responsible for removing buffers no longer in Auto-Revert Mode from auto-revert-buffer-list, and for canceling the timer when no buffers need to be checked.

This function has :around advice: auto-revert-buffers@buffer-list-filter.

Source Code

;; Defined in /usr/src/emacs/lisp/autorevert.el.gz
(defun auto-revert-buffers ()
  "Revert buffers as specified by Auto-Revert and Global Auto-Revert Mode.

Should `global-auto-revert-mode' be active all file buffers are checked.

Should `auto-revert-mode' be active in some buffers, those buffers
are checked.

Non-file buffers that have a custom `revert-buffer-function' and
`buffer-stale-function' are reverted either when Auto-Revert
Mode is active in that buffer, or when the variable
`global-auto-revert-non-file-buffers' is non-nil and Global
Auto-Revert Mode is active.

This function stops whenever there is user input.  The buffers not
checked are stored in the variable `auto-revert-remaining-buffers'.

To avoid starvation, the buffers in `auto-revert-remaining-buffers'
are checked first the next time this function is called.

This function is also responsible for removing buffers no longer in
Auto-Revert Mode from `auto-revert-buffer-list', and for canceling
the timer when no buffers need to be checked."
  (save-match-data
    (let ((bufs (auto-revert--buffer-candidates)))
      (while (and bufs
		  (not (and auto-revert-stop-on-user-input
			    (input-pending-p))))
        (auto-revert-buffer (pop bufs)))
      (setq auto-revert-remaining-buffers bufs)
      ;; Check if we should cancel the timer.
      (unless (auto-revert--need-polling-p)
        (when (timerp auto-revert-timer)
          (cancel-timer auto-revert-timer))
	(setq auto-revert-timer nil)))))