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

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

[elpa] externals/cape 9833045077 017/146: Add completion categories


From: ELPA Syncer
Subject: [elpa] externals/cape 9833045077 017/146: Add completion categories
Date: Sun, 9 Jan 2022 20:57:39 -0500 (EST)

branch: externals/cape
commit 983304507782fbc4805eff8e6af145b399fa0909
Author: Daniel Mendler <mail@daniel-mendler.de>
Commit: Daniel Mendler <mail@daniel-mendler.de>

    Add completion categories
---
 cape.el | 16 +++++++++-------
 1 file changed, 9 insertions(+), 7 deletions(-)

diff --git a/cape.el b/cape.el
index fb4507e0d6..a14a7fa36f 100644
--- a/cape.el
+++ b/cape.el
@@ -488,6 +488,7 @@
               (lambda (str pred action)
                 (if (eq action 'metadata)
                     '(metadata
+                      (category . cape-merged)
                       (display-sort-function . identity)
                       (cycle-sort-function . identity))
                   (complete-with-action action candidates str pred)))
@@ -535,16 +536,17 @@ This feature is experimental."
                 ;; future is returned, the capf should fail first. As soon as 
the future
                 ;; callback is called, remember the result, refresh the UI and 
return the
                 ;; remembered result the next time the capf is called.
-                (let ((sorted (cape--company-call backend 'sorted))
-                      (no-cache (cape--company-call backend 'no-cache))
+                (let ((no-cache (cape--company-call backend 'no-cache))
                       (dups (if (cape--company-call backend 'duplicates) 
#'delete-dups #'identity))
-                      (candidates nil))
+                      (candidates nil)
+                      (metadata `(metadata (category . ,backend))))
+                  (when (cape--company-call backend 'sorted)
+                    (nconc metadata '((display-sort-function . identity)
+                                      (cycle-sort-function . identity))))
                   (list (- (point) (length input)) (point)
                         (lambda (str pred action)
-                          (if (and (eq action 'metadata) sorted)
-                              '(metadata
-                                (display-sort-function . identity)
-                                (cycle-sort-function . identity))
+                          (if (eq action 'metadata)
+                              metadata
                             (complete-with-action
                              action
                              (if no-cache



reply via email to

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