branch: externals/corfu-doc
commit 214b14115e7464a01ea22e513a52af6783a32e42
Author: Yuwei Tian <[email protected]>
Commit: Yuwei Tian <[email protected]>
Hide doc frame if there is no documentation
---
corfu-doc.el | 22 ++++++++++++----------
1 file changed, 12 insertions(+), 10 deletions(-)
diff --git a/corfu-doc.el b/corfu-doc.el
index d6cbd2f9e5..4c83919588 100644
--- a/corfu-doc.el
+++ b/corfu-doc.el
@@ -331,16 +331,18 @@ FWIDTH and FHEIGHT."
(corfu-doc--calculate-doc-frame-position))
(setq corfu-doc--cf-frame-edges cf-frame-edges)))
;; fetch documentation and show
- (when-let* ((res (ignore-errors (corfu-doc-fetch-documentation)))
- (doc (unless (string-empty-p (string-trim res)) res)))
- (corfu-doc--make-frame doc)
- (apply #'corfu-doc--set-frame-position
- corfu-doc--frame
- (corfu-doc--calculate-doc-frame-position))
- (setq corfu-doc--candidate candidate)
- (setq corfu-doc--cf-frame-edges cf-frame-edges)))
- (corfu--echo-refresh)
- (setq corfu-doc--window (selected-window)))))
+ (if-let* ((res (ignore-errors (corfu-doc-fetch-documentation)))
+ (doc (unless (string-empty-p (string-trim res)) res)))
+ (progn
+ (corfu-doc--make-frame doc)
+ (apply #'corfu-doc--set-frame-position
+ corfu-doc--frame
+ (corfu-doc--calculate-doc-frame-position))
+ (setq corfu-doc--candidate candidate)
+ (setq corfu-doc--cf-frame-edges cf-frame-edges)
+ (corfu--echo-refresh)
+ (setq corfu-doc--window (selected-window)))
+ (corfu-doc-hide))))))
(defun corfu-doc-manually ()
(interactive)