[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/consult 5564008: consult--buffer-query: Add :predicate
From: |
ELPA Syncer |
Subject: |
[elpa] externals/consult 5564008: consult--buffer-query: Add :predicate argument |
Date: |
Thu, 29 Jul 2021 16:57:08 -0400 (EDT) |
branch: externals/consult
commit 5564008dfc3d4b7a7ba2454e70c570a569290f0c
Author: Daniel Mendler <mail@daniel-mendler.de>
Commit: Daniel Mendler <mail@daniel-mendler.de>
consult--buffer-query: Add :predicate argument
This argument is redundant, since the function already has the :as
argument, but
makes the API slightly friendlier to use.
---
consult-compile.el | 5 ++---
consult.el | 4 +++-
2 files changed, 5 insertions(+), 4 deletions(-)
diff --git a/consult-compile.el b/consult-compile.el
index e83634a..5dbc4cb 100644
--- a/consult-compile.el
+++ b/consult-compile.el
@@ -85,12 +85,11 @@
(defun consult-compile--compilation-buffers (file)
"Return a list of compilation buffers relevant to FILE."
(consult--buffer-query
- :sort 'alpha :as
+ :sort 'alpha :predicate
(lambda (buffer)
(with-current-buffer buffer
(and (compilation-buffer-internal-p)
- (file-in-directory-p file default-directory)
- buffer)))))
+ (file-in-directory-p file default-directory))))))
;;;###autoload
(defun consult-compile-error ()
diff --git a/consult.el b/consult.el
index 0061403..313dab2 100644
--- a/consult.el
+++ b/consult.el
@@ -3603,7 +3603,7 @@ The command supports previewing the currently selected
theme."
nil)))
(nconc (nreverse hidden) buffers (list (current-buffer)))))
-(cl-defun consult--buffer-query (&key sort directory mode as (filter t)
+(cl-defun consult--buffer-query (&key sort directory mode as predicate (filter
t)
include (exclude consult-buffer-filter) )
"Buffer query function.
DIRECTORY can either be project or a path.
@@ -3612,6 +3612,7 @@ FILTER can be either t, nil or invert.
EXCLUDE is a list of regexps.
INCLUDE is a list of regexps.
MODE can be a mode or a list of modes to restrict the returned buffers.
+PREDICATE is a predicate function.
AS is a conversion function."
;; This function is the backbone of most `consult-buffer' source. The
;; function supports filtering by various criteria which are used throughout
@@ -3647,6 +3648,7 @@ AS is a conversion function."
(if (and (/= 0 (length dir)) (eq (aref dir
0) ?/))
dir
(expand-file-name dir)))))
+ (or (not predicate) (funcall predicate it))
(if as (funcall as it) it)))))
buffers)))
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [elpa] externals/consult 5564008: consult--buffer-query: Add :predicate argument,
ELPA Syncer <=