[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/consult 1dcdb3df44: consult--with-async: Delay modifica
From: |
ELPA Syncer |
Subject: |
[elpa] externals/consult 1dcdb3df44: consult--with-async: Delay modification hook |
Date: |
Tue, 13 Sep 2022 15:57:30 -0400 (EDT) |
branch: externals/consult
commit 1dcdb3df44cf02a2ca996b0ba11674ddcdb51ec0
Author: Daniel Mendler <mail@daniel-mendler.de>
Commit: Daniel Mendler <mail@daniel-mendler.de>
consult--with-async: Delay modification hook
Delay modification hook to ensure that minibuffer is still alive after the
change, such that we don't restart a new asynchronous search right before
exiting the minibuffer.
---
consult.el | 25 ++++++++++++++++++-------
1 file changed, 18 insertions(+), 7 deletions(-)
diff --git a/consult.el b/consult.el
index ef6b4d8cf5..6e9a99de4b 100644
--- a/consult.el
+++ b/consult.el
@@ -1696,13 +1696,24 @@ BIND is the asynchronous function binding."
(setq orig-chunk read-process-output-max
read-process-output-max new-chunk)
(funcall ,async 'setup)
- ;; Push input string to request refresh.
- ;; We use a symbol in order to avoid adding lambdas to the
hook variable.
- ;; Symbol indirection because of bug#46407.
- (let ((sym (make-symbol "consult--async-after-change")))
- (fset sym (lambda (&rest _) (funcall ,async
(minibuffer-contents-no-properties))))
- (run-at-time 0 nil sym)
- (add-hook 'after-change-functions sym nil 'local)))))
+ (let* ((mb (current-buffer))
+ (fun (lambda ()
+ (when-let (win (active-minibuffer-window))
+ (when (eq (window-buffer win) mb)
+ (with-current-buffer mb
+ (let ((inhibit-modification-hooks t))
+ ;; Push input string to request refresh.
+ (funcall ,async
(minibuffer-contents-no-properties))))))))
+ ;; We use a symbol in order to avoid adding lambdas to
+ ;; the hook variable. Symbol indirection because of
+ ;; bug#46407.
+ (sym (make-symbol "consult--async-after-change")))
+ ;; Delay modification hook to ensure that minibuffer is still
+ ;; alive after the change, such that we don't restart a new
+ ;; asynchronous search right before exiting the minibuffer.
+ (fset sym (lambda (&rest _) (run-at-time 0 nil fun)))
+ (add-hook 'after-change-functions sym nil 'local)
+ (funcall sym)))))
(let ((,async (if (functionp ,async) ,async (lambda (_) ,async))))
(unwind-protect
,(macroexp-progn body)
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [elpa] externals/consult 1dcdb3df44: consult--with-async: Delay modification hook,
ELPA Syncer <=