[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/corfu-doc be90c96079 84/95: Merge functions to get the
From: |
ELPA Syncer |
Subject: |
[elpa] externals/corfu-doc be90c96079 84/95: Merge functions to get the documentation of the candidate |
Date: |
Tue, 19 Jul 2022 15:58:07 -0400 (EDT) |
branch: externals/corfu-doc
commit be90c960790a7755463145dbef91ad504777b4ad
Author: Yuwei Tian <ibluefocus@outlook.com>
Commit: Yuwei Tian <ibluefocus@outlook.com>
Merge functions to get the documentation of the candidate
---
corfu-doc.el | 42 ++++++++++++++++++++----------------------
1 file changed, 20 insertions(+), 22 deletions(-)
diff --git a/corfu-doc.el b/corfu-doc.el
index 883520b4b0..97359ed6ee 100644
--- a/corfu-doc.el
+++ b/corfu-doc.el
@@ -226,33 +226,31 @@ WINDOW is the current window where the corfu popup is
located."
(set-frame-size frame width height t)
(make-frame-visible frame))
-;; Function adapted from corfu.el by Daniel Mendler
-(defun corfu-doc-fetch-documentation ()
- "Fetch documentation buffer of the current completion candidate."
- (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
- (let ((inhibit-message t)
- (message-log-max nil))
- (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--get-doc ()
"Get the documentation for the current completion candidate.
The documentation is trimmed.
Returns nil if an error occurs or the documentation content is empty."
- (when-let ((doc (ignore-errors (corfu-doc-fetch-documentation))))
+ (when-let
+ ((doc
+ (ignore-errors
+ (cond
+ ((= corfu--total 0) nil) ;; No candidates
+ ((< corfu--index 0) nil) ;; 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
+ (let ((inhibit-message t)
+ (message-log-max nil))
+ (funcall fun (nth corfu--index corfu--candidates))))))
+ (let ((buf (or (car-safe res) res)))
+ (with-current-buffer buf
+ (buffer-string)))
+ nil)))))) ;; No documentation available
(unless (string-empty-p (string-trim doc))
doc)))
- [elpa] externals/corfu-doc c968530f74 50/95: Fix #9: fix showing doc while quickly browsing candidates, (continued)
- [elpa] externals/corfu-doc c968530f74 50/95: Fix #9: fix showing doc while quickly browsing candidates, ELPA Syncer, 2022/07/19
- [elpa] externals/corfu-doc e9562c3936 48/95: Update commentary, ELPA Syncer, 2022/07/19
- [elpa] externals/corfu-doc d857f012ad 33/95: Reduce doc frame flickering when the delay is very low, ELPA Syncer, 2022/07/19
- [elpa] externals/corfu-doc 45853ecb53 24/95: Version 0.1.0, ELPA Syncer, 2022/07/19
- [elpa] externals/corfu-doc dcc481a5d0 58/95: Document display the doc frame within the parent frame, ELPA Syncer, 2022/07/19
- [elpa] externals/corfu-doc e1c79e8ffc 27/95: Version 0.1.1, ELPA Syncer, 2022/07/19
- [elpa] externals/corfu-doc 1fd578caa0 53/95: Fix link, ELPA Syncer, 2022/07/19
- [elpa] externals/corfu-doc d2abf185e6 75/95: Rename corfu-doc--popup-transit to corfu-doc--popup-transition, ELPA Syncer, 2022/07/19
- [elpa] externals/corfu-doc 07d389a0ab 74/95: Make candidates popup and doc popup share the border, ELPA Syncer, 2022/07/19
- [elpa] externals/corfu-doc 832b49e2a1 83/95: Remove :safe args, ELPA Syncer, 2022/07/19
- [elpa] externals/corfu-doc be90c96079 84/95: Merge functions to get the documentation of the candidate,
ELPA Syncer <=
- [elpa] externals/corfu-doc 13574ae5d1 82/95: Make corfu-doc-display-within-parent-frame default to t, ELPA Syncer, 2022/07/19
- [elpa] externals/corfu-doc 616a2a9fc6 93/95: Fix regression error when scrolling doc popup, ELPA Syncer, 2022/07/19
- [elpa] externals/corfu-doc 767e7574ef 89/95: Obsolete toggle-corfu-doc-mode command, ELPA Syncer, 2022/07/19
- [elpa] externals/corfu-doc da93136780 95/95: Increase the default max width of the doc frame to 80 characters, ELPA Syncer, 2022/07/19
- [elpa] externals/corfu-doc 8e463cccad 11/95: Fix #4: add requirement for map library, ELPA Syncer, 2022/07/19
- [elpa] externals/corfu-doc b8b47f79bc 03/95: Make the documentation scrollable, ELPA Syncer, 2022/07/19
- [elpa] externals/corfu-doc d2260b04d7 04/95: Fix doc frame border missing problem, ELPA Syncer, 2022/07/19
- [elpa] externals/corfu-doc fd15093639 05/95: Add left and right margins, ELPA Syncer, 2022/07/19
- [elpa] externals/corfu-doc c6b54c923e 14/95: Add command to quickly toggle documentation popup on or off, ELPA Syncer, 2022/07/19
- [elpa] externals/corfu-doc 98398c61fa 15/95: Fix wrong argument type error when calling frame-visible-p, ELPA Syncer, 2022/07/19