emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] master 5d68a50 069/173: [Fix #317] Allow :sorted keyword in group


From: Dmitry Gutov
Subject: [elpa] master 5d68a50 069/173: [Fix #317] Allow :sorted keyword in grouped backends
Date: Thu, 23 Jun 2016 00:28:38 +0000 (UTC)

branch: master
commit 5d68a504742d6e6a4f79882431f4648a0654a5b9
Author: Vitalie Spinu <address@hidden>
Commit: Vitalie Spinu <address@hidden>

    [Fix #317] Allow :sorted keyword in grouped backends
---
 company.el |   16 +++++++++++-----
 1 file changed, 11 insertions(+), 5 deletions(-)

diff --git a/company.el b/company.el
index c64f0d6..abace2c 100644
--- a/company.el
+++ b/company.el
@@ -429,6 +429,9 @@ the keyword `:with', the backends after it are ignored for 
this command.
 The completions from backends in a group are merged (but only from those
 that return the same `prefix').
 
+If a grouped backend contains keyword `:sorted', the final (merged) list of
+candidates is not sorted.
+
 Asynchronous backends:
 
 The return value of each command can also be a cons (:async . FETCHER)
@@ -892,14 +895,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)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]