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

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

[elpa] externals/corfu 0a16d15257 3/3: corfu-echo-documentation: Add bac


From: ELPA Syncer
Subject: [elpa] externals/corfu 0a16d15257 3/3: corfu-echo-documentation: Add back support for value t
Date: Mon, 21 Feb 2022 10:57:26 -0500 (EST)

branch: externals/corfu
commit 0a16d1525734d1ab6893076c8329bb44fd78c871
Author: Daniel Mendler <mail@daniel-mendler.de>
Commit: Daniel Mendler <mail@daniel-mendler.de>

    corfu-echo-documentation: Add back support for value t
---
 corfu.el | 37 ++++++++++++++++++++-----------------
 1 file changed, 20 insertions(+), 17 deletions(-)

diff --git a/corfu.el b/corfu.el
index e9b759a5e5..0b6e5acc40 100644
--- a/corfu.el
+++ b/corfu.el
@@ -133,9 +133,11 @@ separator: Only stay alive if there is no match and
 
 (defcustom corfu-echo-documentation '(1.0 . 0.2)
   "Show documentation string in the echo area after that number of seconds.
-Set to nil to disable. The value can be a pair of two floats to specify
-initial and subsequent delay."
+Set to nil to disable the echo message or to t for an instant message.
+The value can be a pair of two floats to specify initial and subsequent
+delay."
   :type '(choice (const :tag "Never" nil)
+                 (const :tag "Instant" t)
                  (number :tag "Delay in seconds")
                  (cons :tag "Two Delays"
                        (choice :tag "Initial   " number))
@@ -791,21 +793,22 @@ there hasn't been any input, then quit."
 
 (defun corfu--echo-documentation ()
   "Show documentation string of current candidate in echo area."
-  (when-let* ((delay (if (consp corfu-echo-documentation)
-                         (funcall (if corfu--echo-message #'cdr #'car)
-                                  corfu-echo-documentation)
-                       corfu-echo-documentation))
-              (fun (plist-get corfu--extra :company-docsig))
-              (cand (and (>= corfu--index 0)
-                         (nth corfu--index corfu--candidates))))
-    (if (<= delay 0)
-        (corfu--echo-show (funcall fun cand))
-      (when corfu--echo-timer (cancel-timer corfu--echo-timer))
-      (setq corfu--echo-timer
-            (run-at-time delay nil
-                         (lambda ()
-                           (corfu--echo-show (funcall fun cand)))))))
-  (corfu--echo-show))
+  (if-let* ((delay (if (consp corfu-echo-documentation)
+                       (funcall (if corfu--echo-message #'cdr #'car)
+                                corfu-echo-documentation)
+                     corfu-echo-documentation))
+            (fun (plist-get corfu--extra :company-docsig))
+            (cand (and (>= corfu--index 0)
+                       (nth corfu--index corfu--candidates))))
+      (if (or (eq delay t) (<= delay 0))
+          (corfu--echo-show (funcall fun cand))
+        (when corfu--echo-timer (cancel-timer corfu--echo-timer))
+        (setq corfu--echo-timer
+              (run-at-time delay nil
+                           (lambda ()
+                             (corfu--echo-show (funcall fun cand)))))
+        (corfu--echo-show))
+    (corfu--echo-show)))
 
 (defun corfu--update ()
   "Refresh Corfu UI."



reply via email to

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