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

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

[elpa] externals/consult 80494d1cc1 1/2: Ensure that preview function is


From: ELPA Syncer
Subject: [elpa] externals/consult 80494d1cc1 1/2: Ensure that preview function is called after minibuffer UI candidate computation
Date: Tue, 22 Feb 2022 09:57:22 -0500 (EST)

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

    Ensure that preview function is called after minibuffer UI candidate 
computation
    
    There is a bug in add-hook which prevents us from using buffer-local
    hooks with priorities. See also:
    
    
https://github.com/minad/vertico/commit/2de617a9199d152533ce280c6eb653147f15f8d1
---
 consult.el | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/consult.el b/consult.el
index 02d2a653cf..9f788c2a42 100644
--- a/consult.el
+++ b/consult.el
@@ -1294,8 +1294,8 @@ and CANDIDATE."
               (setq consult--preview-function
                     (let ((last-preview))
                       (lambda ()
-                        (when-let (cand (funcall candidate))
-                          (with-selected-window (active-minibuffer-window)
+                        (with-selected-window (active-minibuffer-window)
+                          (when-let (cand (funcall candidate))
                             (let ((input (minibuffer-contents-no-properties)))
                               (with-selected-window (or 
(minibuffer-selected-window) (next-window))
                                 (let ((transformed (funcall transform input 
cand))
@@ -1322,7 +1322,9 @@ and CANDIDATE."
               (let ((post-command-sym (make-symbol 
"consult--preview-post-command")))
                 (fset post-command-sym (lambda ()
                                          (setq input 
(minibuffer-contents-no-properties))
-                                         (funcall consult--preview-function)))
+                                         ;; Defer running the preview function 
until
+                                         ;; after minibuffer UI candidate 
computation
+                                         (run-at-time 0 nil 
consult--preview-function)))
                 (add-hook 'post-command-hook post-command-sym nil 'local)))
           (lambda ()
             ;; symbol indirection because of bug#46407



reply via email to

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