emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/compat e370f9b7e7 25/84: Add match-buffers from Emacs 2


From: ELPA Syncer
Subject: [elpa] externals/compat e370f9b7e7 25/84: Add match-buffers from Emacs 29
Date: Tue, 3 Jan 2023 08:57:32 -0500 (EST)

branch: externals/compat
commit e370f9b7e7b2bfa679010ea37f03acc01a8ca4ea
Author: Philip Kaludercic <philipk@posteo.net>
Commit: Philip Kaludercic <philipk@posteo.net>

    Add match-buffers from Emacs 29
---
 compat-29.el | 14 ++++++++++++++
 compat.texi  | 12 ++++++++++++
 2 files changed, 26 insertions(+)

diff --git a/compat-29.el b/compat-29.el
index cf1ed41404..757f9e76ee 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 75da790901..c1e61be279 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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]