[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] master c45c5f9 08/40: Extract company-capf--candidates for ease o
From: |
Dmitry Gutov |
Subject: |
[elpa] master c45c5f9 08/40: Extract company-capf--candidates for ease of debugging |
Date: |
Thu, 2 Jan 2020 18:57:00 -0500 (EST) |
branch: master
commit c45c5f9e8d176e5a620d4df5740a85830dda6d72
Author: Dmitry Gutov <address@hidden>
Commit: Dmitry Gutov <address@hidden>
Extract company-capf--candidates for ease of debugging
---
company-capf.el | 48 ++++++++++++++++++++++++++----------------------
1 file changed, 26 insertions(+), 22 deletions(-)
diff --git a/company-capf.el b/company-capf.el
index 64b3de9..8a355df 100644
--- a/company-capf.el
+++ b/company-capf.el
@@ -98,28 +98,7 @@ that accompanied the completion table that's currently is
use.")
(length (cons prefix length))
(t prefix))))))
(`candidates
- (let ((res (company--capf-data)))
- (company-capf--save-current-data res)
- (when res
- (let* ((table (nth 3 res))
- (pred (plist-get (nthcdr 4 res) :predicate))
- (meta (completion-metadata
- (buffer-substring (nth 1 res) (nth 2 res))
- table pred))
- (sortfun (cdr (assq 'display-sort-function meta)))
- (candidates (completion-all-completions arg table pred (length
arg)))
- (last (last candidates))
- (base-size (and (numberp (cdr last)) (cdr last))))
- (when base-size
- (setcdr last nil))
- (when sortfun
- (setq candidates (funcall sortfun candidates)))
- (if (not (zerop (or base-size 0)))
- (let ((before (substring arg 0 base-size)))
- (mapcar (lambda (candidate)
- (concat before candidate))
- candidates))
- candidates)))))
+ (company-capf--candidates arg))
(`sorted
(let ((res company-capf--current-completion-data))
(when res
@@ -177,6 +156,31 @@ that accompanied the completion table that's currently is
use.")
(company--capf-post-completion arg))
))
+(defun company-capf--candidates (input)
+ (let ((res (company--capf-data)))
+ (company-capf--save-current-data res)
+ (when res
+ (let* ((table (nth 3 res))
+ (pred (plist-get (nthcdr 4 res) :predicate))
+ (meta (completion-metadata
+ (buffer-substring (nth 1 res) (nth 2 res))
+ table pred))
+ (sortfun (cdr (assq 'display-sort-function meta)))
+ (candidates (completion-all-completions input table pred
+ (length input)))
+ (last (last candidates))
+ (base-size (and (numberp (cdr last)) (cdr last))))
+ (when base-size
+ (setcdr last nil))
+ (when sortfun
+ (setq candidates (funcall sortfun candidates)))
+ (if (not (zerop (or base-size 0)))
+ (let ((before (substring input 0 base-size)))
+ (mapcar (lambda (candidate)
+ (concat before candidate))
+ candidates))
+ candidates)))))
+
(defun company--capf-post-completion (arg)
(let* ((res company-capf--current-completion-data)
(exit-function (plist-get (nthcdr 4 res) :exit-function))
- [elpa] master 1120b56 04/40: Merge pull request #908 from matthijsk/embarcadero, (continued)
- [elpa] master 1120b56 04/40: Merge pull request #908 from matthijsk/embarcadero, Dmitry Gutov, 2020/01/02
- [elpa] master 65fd368 09/40: Support completion style specific sorting (Emacs 27), Dmitry Gutov, 2020/01/02
- [elpa] master 6d808c4 06/40: Revert "speed up company-etags", Dmitry Gutov, 2020/01/02
- [elpa] master ad6ff0e 01/40: Inhibit template field interaction while completion is active, Dmitry Gutov, 2020/01/02
- [elpa] master 226943f 10/40: Add a couple of clarifying comments, Dmitry Gutov, 2020/01/02
- [elpa] master d497b8c 02/40: speed up company-etags, Dmitry Gutov, 2020/01/02
- [elpa] master 1cb2960 11/40: Use line-wrap in company doc buffer, Dmitry Gutov, 2020/01/02
- [elpa] master f6974e3 07/40: Merge pull request #909 from company-mode/revert-904-master, Dmitry Gutov, 2020/01/02
- [elpa] master ec1fb85 16/40: Fix typos, Dmitry Gutov, 2020/01/02
- [elpa] master 39a74c5 18/40: Add a NEWS entry, Dmitry Gutov, 2020/01/02
- [elpa] master c45c5f9 08/40: Extract company-capf--candidates for ease of debugging,
Dmitry Gutov <=
- [elpa] master ccc22eb 05/40: Merge pull request #904 from redguardtoo/master, Dmitry Gutov, 2020/01/02
- [elpa] master 263438e 12/40: Merge pull request #930 from Zetagon/master, Dmitry Gutov, 2020/01/02
- [elpa] master 3cd2b1a 13/40: Update copyright, Dmitry Gutov, 2020/01/02
- [elpa] master d943198 15/40: Add some clarification for the require-match 'never return value, Dmitry Gutov, 2020/01/02
- [elpa] master 67b6041 17/40: Merge pull request #934 from DamienCassou/typos, Dmitry Gutov, 2020/01/02
- [elpa] master 027d180 22/40: company--perform: Clarify the control flow a little bit, Dmitry Gutov, 2020/01/02
- [elpa] master 7287fa7 28/40: company-show-numbers-function: Improve the docstring, Dmitry Gutov, 2020/01/02
- [elpa] master 14f80ed 27/40: Move face definitions to a separate group, Dmitry Gutov, 2020/01/02
- [elpa] master 74b75eb 31/40: company-gtags--fetch-tags: Allow exit status 1, Dmitry Gutov, 2020/01/02
- [elpa] master 87c35d8 26/40: End group name with period, Dmitry Gutov, 2020/01/02