Function: auto-revert--buffer-candidates

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

Signature

(auto-revert--buffer-candidates)

Documentation

Return a prioritized list of buffers to maybe auto-revert.

The differences between this return value and the reference variable auto-revert-buffer-list include: 1) this has more entries when in global-auto-revert-mode(var)/global-auto-revert-mode(fun); 2) this prioritizes buffers not reverted last time due to user interruption.

Source Code

;; Defined in /usr/src/emacs/lisp/autorevert.el.gz
(defun auto-revert--buffer-candidates ()
  "Return a prioritized list of buffers to maybe auto-revert.
The differences between this return value and the reference
variable `auto-revert-buffer-list' include: 1) this has more
entries when in `global-auto-revert-mode'; 2) this prioritizes
buffers not reverted last time due to user interruption."
  (let ((bufs (delq nil
                    ;; Buffers with remote contents shall be reverted only
                    ;; if the connection is established already.
                    (mapcar
                     (lambda (buf)
                       (and (buffer-live-p buf)
                            (with-current-buffer buf
                              (and
                               (or (not (file-remote-p default-directory))
                                   (file-remote-p default-directory nil t))
                               buf))))
                     (auto-revert--polled-buffers))))
        remaining new)
    ;; Partition `bufs' into two halves depending on whether or not
    ;; the buffers are in `auto-revert-remaining-buffers'.  The two
    ;; halves are then re-joined with the "remaining" buffers at the
    ;; head of the list.
    (dolist (buf auto-revert-remaining-buffers)
      (when (memq buf bufs)
        (push buf remaining)))
    (dolist (buf bufs)
      (unless (memq buf remaining)
        (push buf new)))
    (nreverse (nconc new remaining))))