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

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

[elpa] externals/corfu-doc 2e74659620 60/95: Hide the doc frame when cur


From: ELPA Syncer
Subject: [elpa] externals/corfu-doc 2e74659620 60/95: Hide the doc frame when current candidate is nil
Date: Tue, 19 Jul 2022 15:58:05 -0400 (EDT)

branch: externals/corfu-doc
commit 2e74659620eb26ef812f9a854d047d0d839c8111
Author: Yuwei Tian <ibluefocus@outlook.com>
Commit: Yuwei Tian <ibluefocus@outlook.com>

    Hide the doc frame when current candidate is nil
---
 corfu-doc.el | 47 +++++++++++++++++++++++++----------------------
 1 file changed, 25 insertions(+), 22 deletions(-)

diff --git a/corfu-doc.el b/corfu-doc.el
index e4194c80ca..7cb076c904 100644
--- a/corfu-doc.el
+++ b/corfu-doc.el
@@ -434,28 +434,31 @@ FWIDTH and FHEIGHT."
      (advice-remove 'corfu--popup-hide #'corfu-doc--hide))))
 
 (defun corfu-doc--auto-show (&rest _args)
-  (let ((candidate (corfu-doc--get-candidate)))
-    (unless (and (string= candidate corfu-doc--candidate)
-                 (eq (selected-window) corfu-doc--window))
-      (when (and (frame-live-p corfu-doc--frame)
-                 (frame-visible-p corfu-doc--frame))
-        (if (and corfu-doc-mode corfu-doc-auto)
-            (if (> corfu-doc-delay 0)
-                (if (> corfu-doc-delay corfu-doc-hide-threshold)
-                    (make-frame-invisible corfu-doc--frame)
-                  ;; clear buffer and reset doc frame position immediately
-                  (corfu-doc--clear-buffer)
-                  (let ((cf-frame-edges (frame-edges corfu--frame 'inner)))
-                    (unless (equal cf-frame-edges corfu-doc--cf-frame-edges)
-                      (apply #'corfu-doc--set-frame-position
-                             corfu-doc--frame
-                             (corfu-doc--calculate-doc-frame-position
-                              (frame-pixel-width corfu-doc--frame)
-                              (frame-pixel-height corfu-doc--frame)))))))
-          (corfu-doc--hide)))))
-  (when (and corfu-doc-mode corfu-doc-auto)
-    (setq corfu-doc--timer
-          (run-with-timer corfu-doc-delay nil #'corfu-doc--show 
corfu--index))))
+  (if-let ((candidate (corfu-doc--get-candidate)))
+      (progn
+        (unless (and (string= candidate corfu-doc--candidate)
+                     (eq (selected-window) corfu-doc--window))
+          (when (and (frame-live-p corfu-doc--frame)
+                     (frame-visible-p corfu-doc--frame))
+            (if (and corfu-doc-mode corfu-doc-auto)
+                (if (> corfu-doc-delay 0)
+                    (if (> corfu-doc-delay corfu-doc-hide-threshold)
+                        (make-frame-invisible corfu-doc--frame)
+                      ;; clear buffer and reset doc frame position immediately
+                      (corfu-doc--clear-buffer)
+                      (let ((cf-frame-edges (frame-edges corfu--frame 'inner)))
+                        (unless (equal cf-frame-edges 
corfu-doc--cf-frame-edges)
+                          (apply #'corfu-doc--set-frame-position
+                                 corfu-doc--frame
+                                 (corfu-doc--calculate-doc-frame-position
+                                  (frame-pixel-width corfu-doc--frame)
+                                  (frame-pixel-height corfu-doc--frame)))))))
+              (corfu-doc--hide))))
+        (when (and corfu-doc-mode corfu-doc-auto)
+          (setq corfu-doc--timer
+                (run-with-timer corfu-doc-delay nil
+                                #'corfu-doc--show corfu--index))))
+    (corfu-doc--hide)))
 
 (defun corfu-doc--cleanup ()
   (advice-remove 'corfu--popup-hide #'corfu-doc--cleanup)



reply via email to

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