[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/consult b96eb9944b 2/2: Improve consult--dynamic-collec
From: |
ELPA Syncer |
Subject: |
[elpa] externals/consult b96eb9944b 2/2: Improve consult--dynamic-collection-source |
Date: |
Fri, 2 Dec 2022 00:57:51 -0500 (EST) |
branch: externals/consult
commit b96eb9944b433300c7e9ac5a856293821d93c549
Author: Daniel Mendler <mail@daniel-mendler.de>
Commit: Daniel Mendler <mail@daniel-mendler.de>
Improve consult--dynamic-collection-source
---
consult.el | 18 ++++++------------
1 file changed, 6 insertions(+), 12 deletions(-)
diff --git a/consult.el b/consult.el
index 6a66616fa6..f50c18bbed 100644
--- a/consult.el
+++ b/consult.el
@@ -2132,21 +2132,15 @@ The refresh happens after a DELAY, defaulting to
`consult-async-refresh-delay'."
"Dynamic collection source.
ASYNC is the sink.
FUN computes the candidates given the input."
- (let (input current)
+ (let ((input "") current)
(lambda (action)
(pcase action
('nil
- (when input
- (if (equal input current)
- (funcall async nil)
- (let ((candidates (funcall fun input)))
- (funcall async 'flush)
- (setq current input)
- (funcall async candidates)))))
- (""
- (setq input "" current "")
- (funcall async 'flush)
- (funcall async 'refresh))
+ (if (or (equal input "") (equal input current))
+ (funcall async nil)
+ (funcall async (prog1 (funcall fun input)
+ (funcall async 'flush)
+ (setq current input)))))
((pred stringp)
(setq input action)
(funcall async 'refresh))