[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] master 46d4455 071/173: Merge pull request #402 from vspinu/sorte
From: |
Dmitry Gutov |
Subject: |
[elpa] master 46d4455 071/173: Merge pull request #402 from vspinu/sorted |
Date: |
Thu, 23 Jun 2016 00:28:39 +0000 (UTC) |
branch: master
commit 46d44559b8996683930b725642f04f58c713b8a5
Merge: 7afffbc 050c0c1
Author: Dmitry Gutov <address@hidden>
Commit: Dmitry Gutov <address@hidden>
Merge pull request #402 from vspinu/sorted
[Fix #317] Allow :sorted keyword in grouped back-ends and some doc
improvements
---
company.el | 43 +++++++++++++++++++++++++------------------
1 file changed, 25 insertions(+), 18 deletions(-)
diff --git a/company.el b/company.el
index c64f0d6..3c00ba5 100644
--- a/company.el
+++ b/company.el
@@ -354,7 +354,8 @@ prefix, but match it in some backend-defined way).
Backends that use this
feature must disable cache (return t to `no-cache') and might also want to
respond to `match'.
-Optional commands:
+Optional commands
+=================
`sorted': Return t here to indicate that the candidates are sorted and will
not need to be sorted again.
@@ -414,22 +415,25 @@ The backend should return nil for all commands it does
not support or
does not know about. It should also be callable interactively and use
`company-begin-backend' to start itself in that case.
-Grouped backends:
+Grouped backends
+================
-An element of `company-backends' can also itself be a list of backends,
-then it's considered to be a \"grouped\" backend.
+An element of `company-backends' can also be a list of backends. The
+completions from backends in such groups are merged, but only from those
+backends which return the same `prefix'.
-When possible, commands taking a candidate as an argument are dispatched to
-the backend it came from. In other cases, the first non-nil value among
-all the backends is returned.
+Whenever makes sense, company commands taking a candidate as an argument
+are dispatched to the backend it came from. In other cases, the first
+non-nil value among all the backends is returned.
-The latter is the case for the `prefix' command. But if the group contains
-the keyword `:with', the backends after it are ignored for this command.
+The group can also contain keywords. Currently, `:with' and `:sorted'
+keywords are defined. If the group contains keyword `:with' , the backends
+listed after this keyword are ignored for the purpose of `prefix'
+command. If a grouped backend contains keyword `:sorted', the
+final (merged) list of candidates is not sorted.
-The completions from backends in a group are merged (but only from those
-that return the same `prefix').
-
-Asynchronous backends:
+Asynchronous backends
+=====================
The return value of each command can also be a cons (:async . FETCHER)
where FETCHER is a function of one argument, CALLBACK. When the data
@@ -892,14 +896,17 @@ means that `company-mode' is always turned on except in
`message-mode' buffers."
when (not (and (symbolp b)
(eq 'failed (get b 'company-init))))
collect b)))
- (setq backends
- (if (eq command 'prefix)
- (butlast backends (length (member :with backends)))
- (delq :with backends)))
+
+ (when (eq command 'prefix)
+ (setq backends (butlast backends (length (member :with backends)))))
+
+ (unless (memq command '(sorted))
+ (setq backends (cl-delete-if #'keywordp backends)))
+
(pcase command
(`candidates
(company--multi-backend-adapter-candidates backends (car args)))
- (`sorted nil)
+ (`sorted (memq :sorted backends))
(`duplicates t)
((or `prefix `ignore-case `no-cache `require-match)
(let (value)
- [elpa] master a053848 050/173: Sort alphabetically, to appease a test, (continued)
- [elpa] master a053848 050/173: Sort alphabetically, to appease a test, Dmitry Gutov, 2016/06/22
- [elpa] master 25cf452 060/173: Don't start automatically during macro recording, Dmitry Gutov, 2016/06/22
- [elpa] master 7419d5f 058/173: Update the tests, Dmitry Gutov, 2016/06/22
- [elpa] master 8202638 041/173: Document ignore-case backend command, Dmitry Gutov, 2016/06/22
- [elpa] master d463642 062/173: company-etags-find-table: fix fallback tags file expansion, Dmitry Gutov, 2016/06/22
- [elpa] master 5f8e6eb 066/173: Merge pull request #397 from bremner/make-elpa-fix, Dmitry Gutov, 2016/06/22
- [elpa] master 6e88174 053/173: Don't cut off the last character from a wrapped line, Dmitry Gutov, 2016/06/22
- [elpa] master 1079d1a 057/173: Use cl-labels instead of cl-flet, for cl-lib shim compatibility, Dmitry Gutov, 2016/06/22
- [elpa] master 3aa806f 063/173: company-etags-find-table: check that TAGS is a regular file, cf. #222, Dmitry Gutov, 2016/06/22
- [elpa] master 93aa472 064/173: Merge pull request #382 from ilohmar/etags-fix, Dmitry Gutov, 2016/06/22
- [elpa] master 46d4455 071/173: Merge pull request #402 from vspinu/sorted,
Dmitry Gutov <=
- [elpa] master 050c0c1 070/173: Improvements of the `company-backends` docstring, Dmitry Gutov, 2016/06/22
- [elpa] master 4646d35 078/173: Allow advising company-dabbrev(-code)? regex generation, Dmitry Gutov, 2016/06/22
- [elpa] master ed3e711 084/173: company-yasnippet: Disable cache (#422), Dmitry Gutov, 2016/06/22
- [elpa] master 7d14350 051/173: company-eclim-executable: Pick up the value of eclim-executable, if present, Dmitry Gutov, 2016/06/22
- [elpa] master 9e66366 067/173: Fix #404 by blanking out line-prefix again, Dmitry Gutov, 2016/06/22
- [elpa] master 433ae92 072/173: Retouch the docstring further, Dmitry Gutov, 2016/06/22
- [elpa] master 02d0e74 074/173: Modernize the Commentary a bit, Dmitry Gutov, 2016/06/22
- [elpa] master 7d005c4 080/173: Document some company-grab- functions, Dmitry Gutov, 2016/06/22
- [elpa] master 07a4e9e 094/173: Travis: Try to fix the "held broken packages", Dmitry Gutov, 2016/06/22
- [elpa] master 7779820 092/173: Remove completions without annotations when considering duplicates, Dmitry Gutov, 2016/06/22