[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/consult 94d49e9006 1/2: consult--async-dynamic: Check t
From: |
ELPA Syncer |
Subject: |
[elpa] externals/consult 94d49e9006 1/2: consult--async-dynamic: Check that callback is not called after returning |
Date: |
Tue, 21 Jan 2025 09:58:03 -0500 (EST) |
branch: externals/consult
commit 94d49e9006959a6d64766a62fe1ca8c66dea9612
Author: Daniel Mendler <mail@daniel-mendler.de>
Commit: Daniel Mendler <mail@daniel-mendler.de>
consult--async-dynamic: Check that callback is not called after returning
---
consult.el | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)
diff --git a/consult.el b/consult.el
index 0760537e93..4d6806b3d7 100644
--- a/consult.el
+++ b/consult.el
@@ -2238,22 +2238,25 @@ restarted and defaults to
`consult-async-input-debounce'."
(cancel-timer timer)
(funcall sink [indicator running])
(redisplay)
- (let* ((flush t)
+ (let* ((state 'init)
(killed
(while-no-input
(funcall
fun input
(lambda (response)
+ (when (eq state 'done)
+ (error "consult--async-dynamic: Callback called
too late"))
(let (throw-on-input)
- (when flush
+ (when (eq state 'init)
(funcall sink 'flush)
- (setq flush nil))
+ (setq state 'running))
(when response
(funcall sink response)
;; Accept process input such that timers
;; trigger and refresh the completion UI.
(accept-process-output)))))
- (setq current input)
+ (setq current input
+ state 'done)
nil)))
(funcall sink `[indicator ,(if killed 'killed 'finished)])
(funcall sink 'refresh)