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

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

[elpa] externals/consult 8034164: Ensure that initial preview works for


From: ELPA Syncer
Subject: [elpa] externals/consult 8034164: Ensure that initial preview works for asynchronous functions (Fix #436)
Date: Fri, 8 Oct 2021 10:57:15 -0400 (EDT)

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

    Ensure that initial preview works for asynchronous functions (Fix #436)
---
 consult.el | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/consult.el b/consult.el
index 717f42a..b8b0c8f 100644
--- a/consult.el
+++ b/consult.el
@@ -1466,21 +1466,27 @@ actions no assumption about the context can be made.
 nil      Return the list of candidates.
 list     Append the list to the already existing candidates list and return it.
 string   Update with the current user input string. Return nil."
-  (let ((candidates) (last) (buffer))
+  (let (candidates last buffer previewed)
     (lambda (action)
       (pcase-exhaustive action
         ('setup
          (setq buffer (current-buffer))
          nil)
         ((or (pred stringp) 'destroy) nil)
-        ('flush (setq candidates nil last nil))
+        ('flush (setq candidates nil last nil previewed nil))
         ('refresh
          ;; Refresh the UI when the current minibuffer window belongs
          ;; to the current asynchronous completion session.
          (when-let (win (active-minibuffer-window))
            (when (eq (window-buffer win) buffer)
              (with-selected-window win
-               (run-hooks 'consult--completion-refresh-hook))))
+               (run-hooks 'consult--completion-refresh-hook)
+               ;; Interaction between asynchronous completion tables and
+               ;; preview: We have to trigger preview immediately when
+               ;; candidates arrive (Issue #436).
+               (when (and consult--preview-function candidates (not previewed))
+                 (setq previewed t)
+                 (funcall consult--preview-function)))))
          nil)
         ('nil candidates)
         ((pred consp)



reply via email to

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