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

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

[elpa] externals/consult 202b8b8 3/3: Ensure that async setup happens la


From: ELPA Syncer
Subject: [elpa] externals/consult 202b8b8 3/3: Ensure that async setup happens later
Date: Thu, 2 Dec 2021 05:57:12 -0500 (EST)

branch: externals/consult
commit 202b8b8077be9d873319286f0804f771bd44a3c9
Author: Daniel Mendler <mail@daniel-mendler.de>
Commit: Daniel Mendler <mail@daniel-mendler.de>

    Ensure that async setup happens later
    
    This should fix consult-grep with fido-mode (See #476)
---
 README.org |  6 ++----
 consult.el | 28 ++++++++++++++++------------
 2 files changed, 18 insertions(+), 16 deletions(-)

diff --git a/README.org b/README.org
index dea1316..aa88ca1 100644
--- a/README.org
+++ b/README.org
@@ -1072,10 +1072,8 @@ out the following steps:
    This includes Consult, Vertico, Selectrum, Icomplete-vertical, Marginalia,
    Embark, Orderless and Prescient in case you are using any of those packages.
 2. Either use the default completion UI or ensure that exactly one of
-   =vertico-mode=, =selectrum-mode=, =mct-mode=, or =icomplete-mode= is 
enabled. (Use
-   =icomplete-mode= instead of =fido-mode=, since Fido always overwrites the
-   =completion-styles= style with =flex=. Furthermore =ivy-mode= and 
=helm-mode= must be
-   disabled.)
+   =vertico-mode=, =selectrum-mode=, =mct-mode=, or =icomplete-mode= is 
enabled.
+   Furthermore =ivy-mode= and =helm-mode= must be disabled.
 3. Ensure that the =completion-styles= variable is properly configured. Try to 
set
    =completion-styles= to a list including =substring= or =orderless=.
 4. Try to reproduce the issue by starting a bare bone Emacs instance with 
=emacs -Q=
diff --git a/consult.el b/consult.el
index 89647b9..ae12c61 100644
--- a/consult.el
+++ b/consult.el
@@ -1447,18 +1447,22 @@ BIND is the asynchronous function binding."
   (let ((async (car bind)))
     `(let ((,async ,@(cdr bind)) (orig-chunk))
        (consult--minibuffer-with-setup-hook
-           (lambda ()
-             (when (functionp ,async)
-               (setq orig-chunk read-process-output-max
-                     read-process-output-max (max read-process-output-max 
consult--process-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))))
+           ;; Append such that we overwrite the completion style setting of
+           ;; `fido-mode'. See `consult--async-split' and
+           ;; `consult--split-setup'.
+           (:append
+            (lambda ()
+              (when (functionp ,async)
+                (setq orig-chunk read-process-output-max
+                      read-process-output-max (max read-process-output-max 
consult--process-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 ((,async (if (functionp ,async) ,async (lambda (_) ,async))))
            (unwind-protect
                ,(macroexp-progn body)



reply via email to

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