[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/corfu-doc d05a3caeb8 02/95: Hide doc frame when there a
From: |
ELPA Syncer |
Subject: |
[elpa] externals/corfu-doc d05a3caeb8 02/95: Hide doc frame when there are no candidates |
Date: |
Tue, 19 Jul 2022 15:57:59 -0400 (EDT) |
branch: externals/corfu-doc
commit d05a3caeb8745ed29699baae7970972dd149ff81
Author: Tian Yuwei <ibluefocus@outlook.com>
Commit: Tian Yuwei <ibluefocus@outlook.com>
Hide doc frame when there are no candidates
---
corfu-doc.el | 55 ++++++++++++++++++++++++++++++-------------------------
1 file changed, 30 insertions(+), 25 deletions(-)
diff --git a/corfu-doc.el b/corfu-doc.el
index da72657482..e57ae066ac 100644
--- a/corfu-doc.el
+++ b/corfu-doc.el
@@ -155,17 +155,21 @@
;; Function adapted from corfu.el by Daniel Mendler
(defun corfu-doc-fetch-documentation ()
"Fetch documentation buffer of current candidate."
- (when (< corfu--index 0)
- (user-error "No candidate selected"))
- (if-let* ((fun (plist-get corfu--extra :company-doc-buffer))
- (res
- ;; fix showing candidate location when fetch helpful documentation
- (save-excursion
- (funcall fun (nth corfu--index corfu--candidates)))))
- (let ((buf (or (car-safe res) res)))
- (with-current-buffer buf
- (buffer-string)))
- (user-error "No documentation available")))
+ (cond
+ ((= corfu--total 0)
+ (user-error "No candidates"))
+ ((< corfu--index 0)
+ (user-error "No candidate selected"))
+ (t
+ (if-let* ((fun (plist-get corfu--extra :company-doc-buffer))
+ (res
+ ;; fix showing candidate location when fetch helpful
documentation
+ (save-excursion
+ (funcall fun (nth corfu--index corfu--candidates)))))
+ (let ((buf (or (car-safe res) res)))
+ (with-current-buffer buf
+ (buffer-string)))
+ (user-error "No documentation available")))))
(defun corfu-doc--calculate-doc-frame-position ()
"Calculate doc frame position (x, y), pixel width and height."
@@ -214,20 +218,21 @@
(list x y cf-doc-frame-width cf-doc-frame-height)))
(defun corfu-doc--show ()
- (when-let* ((corfu-on (and (fboundp 'corfu-mode) corfu-mode))
- (f-v-p (frame-visible-p corfu--frame))
- (candidate (nth corfu--index corfu--candidates)))
- (unless (and (string= corfu-doc--candidate candidate)
- (frame-visible-p corfu-doc--frame)
- (eq (selected-window) corfu-doc--window))
- ;; show doc frame
- (when-let* ((doc (ignore-errors
- (corfu-doc-fetch-documentation)))
- (doc-frame
- (eval `(corfu-doc--make-frame
- ,@(corfu-doc--calculate-doc-frame-position) ,doc))))
- (setq corfu-doc--candidate candidate)
- (setq corfu-doc--window (selected-window))))))
+ (let ((candidate (and (> corfu--total 0)
+ (nth corfu--index corfu--candidates))))
+ (if candidate
+ (when-let* ((corfu-on (and (fboundp 'corfu-mode) corfu-mode))
+ (f-v-p (frame-visible-p corfu--frame)))
+ (unless (and (string= corfu-doc--candidate candidate)
+ (frame-visible-p corfu-doc--frame)
+ (eq (selected-window) corfu-doc--window))
+ ;; show doc frame
+ (when-let* ((doc (ignore-errors (corfu-doc-fetch-documentation))))
+ (eval `(corfu-doc--make-frame
+ ,@(corfu-doc--calculate-doc-frame-position) ,doc)))))
+ (corfu-doc--hide))
+ (setq corfu-doc--candidate candidate)
+ (setq corfu-doc--window (selected-window))))
(defun corfu-doc--hide ()
(when (frame-live-p corfu-doc--frame)
- [elpa] externals/corfu-doc 1c99932d33 57/95: Support displaying the doc frame within the parent frame, (continued)
- [elpa] externals/corfu-doc 1c99932d33 57/95: Support displaying the doc frame within the parent frame, ELPA Syncer, 2022/07/19
- [elpa] externals/corfu-doc 6706526c0d 72/95: Require emacs 27.1, ELPA Syncer, 2022/07/19
- [elpa] externals/corfu-doc f9566cf13f 80/95: Version 0.6.3, ELPA Syncer, 2022/07/19
- [elpa] externals/corfu-doc 4119d58e8e 76/95: Rename calculating doc popup position function, ELPA Syncer, 2022/07/19
- [elpa] externals/corfu-doc a0508b031e 85/95: Inline the function to scroll the doc popup, ELPA Syncer, 2022/07/19
- [elpa] externals/corfu-doc 0c5bd800f6 71/95: Fix frame flicker When display the doc immediately, ELPA Syncer, 2022/07/19
- [elpa] externals/corfu-doc 7f7e251173 92/95: Fix #19: display a warning when child frames unavailable, ELPA Syncer, 2022/07/19
- [elpa] externals/corfu-doc cfca07f581 81/95: Require corfu 0.25, ELPA Syncer, 2022/07/19
- [elpa] externals/corfu-doc 48f629a0c2 87/95: Add new option to choose the method to transition the doc popup, ELPA Syncer, 2022/07/19
- [elpa] externals/corfu-doc b5477fd110 90/95: Version 0.7, ELPA Syncer, 2022/07/19
- [elpa] externals/corfu-doc d05a3caeb8 02/95: Hide doc frame when there are no candidates,
ELPA Syncer <=
- [elpa] externals/corfu-doc 53b58bbc70 01/95: Initial commit, ELPA Syncer, 2022/07/19
- [elpa] externals/corfu-doc 000388fe97 06/95: Silent a compiler warning, ELPA Syncer, 2022/07/19
- [elpa] externals/corfu-doc f89ddb7c65 12/95: Sync corfu's update on redisplay hack, ELPA Syncer, 2022/07/19
- [elpa] externals/corfu-doc 7c546a3eae 16/95: Hide popup frame when candidate documentation is empty, ELPA Syncer, 2022/07/19
- [elpa] externals/corfu-doc f030d58176 17/95: Version 0.0.4, ELPA Syncer, 2022/07/19
- [elpa] externals/corfu-doc eac54c356a 07/95: Version 0.0.2, ELPA Syncer, 2022/07/19
- [elpa] externals/corfu-doc 807af9fb2e 08/95: Fix #2: fix frame position calculation when there are multiple displays, ELPA Syncer, 2022/07/19
- [elpa] externals/corfu-doc c2460635d9 19/95: Inhibit message when fetching the candidate documentation, ELPA Syncer, 2022/07/19
- [elpa] externals/corfu-doc fa5f36599d 20/95: Force to refresh corfu echo message, ELPA Syncer, 2022/07/19
- [elpa] externals/corfu-doc fa6cb6b384 45/95: Add melpa badge, ELPA Syncer, 2022/07/19