diff options
| author | Philip Kaludercic <philipk@posteo.net> | 2022-08-10 20:33:30 +0200 |
|---|---|---|
| committer | Philip Kaludercic <philipk@posteo.net> | 2022-08-10 20:33:30 +0200 |
| commit | e370f9b7e7b2bfa679010ea37f03acc01a8ca4ea (patch) | |
| tree | 407e27419f34a932f1cc25a4b722073fba6d7bcb | |
| parent | 933d6fdf8086ff5908df6daa556ab14eb029e183 (diff) | |
Add match-buffers from Emacs 29
| -rw-r--r-- | compat-29.el | 14 | ||||
| -rw-r--r-- | compat.texi | 12 |
2 files changed, 26 insertions, 0 deletions
diff --git a/compat-29.el b/compat-29.el index cf1ed41..757f9e7 100644 --- a/compat-29.el +++ b/compat-29.el @@ -250,6 +250,20 @@ CONDITION is either: (throw 'match t))))))) (funcall match (list condition)))) +;;* UNTESTED +(compat-defun match-buffers (condition &optional buffers arg) + "Return a list of buffers that match CONDITION. +See `buffer-match' for details on CONDITION. By default all +buffers are checked, this can be restricted by passing an +optional argument BUFFERS, set to a list of buffers to check. +ARG is passed to `buffer-match', for predicate conditions in +CONDITION." + (let (bufs) + (dolist (buf (or buffers (buffer-list))) + (when (compat--buffer-match-p condition (get-buffer buf) arg) + (push buf bufs))) + bufs)) + ;;;; Defined in subr-x.el (compat-defun string-limit (string length &optional end coding-system) diff --git a/compat.texi b/compat.texi index 75da790..c1e61be 100644 --- a/compat.texi +++ b/compat.texi @@ -2434,6 +2434,18 @@ string), @code{(and)} (empty conjunction) or @code{always}. @xref{Buffer List,,,elisp}. @end defun +@c copied from lispref/buffers.texi +@defun match-buffers condition &optional buffers arg +This function returns a list of all buffers that satisfy a +@code{condition}, as defined for @code{buffer-match-p}. By default +all buffers are considered, but this can be restricted via the second +optional @code{buffer-list} argument. Optional third argument +@var{arg} will be used by @var{condition} in the same way as +@code{buffer-match-p} does. + +@xref{Buffer List,,,elisp}. +@end defun + @subsection Prefixed Definitions |
