[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] master 65fd368 09/40: Support completion style specific sorting (
From: |
Dmitry Gutov |
Subject: |
[elpa] master 65fd368 09/40: Support completion style specific sorting (Emacs 27) |
Date: |
Thu, 2 Jan 2020 18:57:00 -0500 (EST) |
branch: master
commit 65fd3685e627b9b45535c6251e633795c4cbd43d
Author: Dmitry Gutov <address@hidden>
Commit: Dmitry Gutov <address@hidden>
Support completion style specific sorting (Emacs 27)
---
company-capf.el | 15 +++++++--------
1 file changed, 7 insertions(+), 8 deletions(-)
diff --git a/company-capf.el b/company-capf.el
index 8a355df..e8b425b 100644
--- a/company-capf.el
+++ b/company-capf.el
@@ -83,6 +83,8 @@ that accompanied the completion table that's currently is
use.")
(defun company-capf--clear-current-data (_ignored)
(setq company-capf--current-completion-data nil))
+(defvar-local company-capf--sorted nil)
+
(defun company-capf (command &optional arg &rest _args)
"`company-mode' backend using `completion-at-point-functions'."
(interactive (list 'interactive))
@@ -100,12 +102,7 @@ that accompanied the completion table that's currently is
use.")
(`candidates
(company-capf--candidates arg))
(`sorted
- (let ((res company-capf--current-completion-data))
- (when res
- (let ((meta (completion-metadata
- (buffer-substring (nth 1 res) (nth 2 res))
- (nth 3 res) (plist-get (nthcdr 4 res) :predicate))))
- (cdr (assq 'display-sort-function meta))))))
+ company-capf--sorted)
(`match
;; Ask the for the `:company-match' function. If that doesn't help,
;; fallback to sniffing for face changes to get a suitable value.
@@ -165,13 +162,15 @@ that accompanied the completion table that's currently is
use.")
(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)))
+ (length input)
+ meta))
+ (sortfun (cdr (assq 'display-sort-function meta)))
(last (last candidates))
(base-size (and (numberp (cdr last)) (cdr last))))
(when base-size
(setcdr last nil))
+ (setq company-capf--sorted (functionp sortfun))
(when sortfun
(setq candidates (funcall sortfun candidates)))
(if (not (zerop (or base-size 0)))
- [elpa] master updated (c084cc1 -> ed14c67), Dmitry Gutov, 2020/01/02
- [elpa] master 6274149 03/40: Add Embarcadero clang-based compilers to company-clang-version, Dmitry Gutov, 2020/01/02
- [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 <=
- [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, 2020/01/02
- [elpa] master ccc22eb 05/40: Merge pull request #904 from redguardtoo/master, Dmitry Gutov, 2020/01/02