Function: match-buffers

match-buffers is a byte-compiled function defined in subr.el.gz.

Signature

(match-buffers CONDITION &optional BUFFERS &rest ARGS)

Documentation

Return a list of buffers that match CONDITION, or nil if none match.

See buffer-match-p for various supported CONDITIONs. By default all buffers are checked, but the optional argument BUFFERS can restrict that: its value should be an explicit list of buffers to check. Optional arguments ARGS are passed to buffer-match-p, for predicate conditions in CONDITION.

View in manual

Probably introduced at or before Emacs version 29.1.

Source Code

;; Defined in /usr/src/emacs/lisp/subr.el.gz
(defun match-buffers (condition &optional buffers &rest args)
  "Return a list of buffers that match CONDITION, or nil if none match.
See `buffer-match-p' for various supported CONDITIONs.
By default all buffers are checked, but the optional
argument BUFFERS can restrict that: its value should be
an explicit list of buffers to check.
Optional arguments ARGS are passed to `buffer-match-p', for
predicate conditions in CONDITION."
  (let (bufs)
    (dolist (buf (or buffers (buffer-list)))
      (when (apply #'buffer-match-p condition (get-buffer buf) args)
        (push buf bufs)))
    bufs))