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

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

[elpa] externals/cape 4b424150ef 090/146: cape-super-capf: Delete duplic


From: ELPA Syncer
Subject: [elpa] externals/cape 4b424150ef 090/146: cape-super-capf: Delete duplicates (Fix #13)
Date: Sun, 9 Jan 2022 20:57:45 -0500 (EST)

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

    cape-super-capf: Delete duplicates (Fix #13)
---
 cape.el | 19 +++++++++++--------
 1 file changed, 11 insertions(+), 8 deletions(-)

diff --git a/cape.el b/cape.el
index deac42a270..a24a7e6f7a 100644
--- a/cape.el
+++ b/cape.el
@@ -687,14 +687,17 @@ If INTERACTIVE is nil the function acts like a capf."
                    ;; NOTE: Set `candidates' in the end, such that the 
completion table is
                    ;; interruptible.
                    (setq candidates
-                         (cl-loop for (table . plist) in tables nconc
-                                  (let* ((pred (plist-get plist :predicate))
-                                         (metadata (completion-metadata "" 
table pred))
-                                         (sort (or (completion-metadata-get 
metadata 'display-sort-function)
-                                                   #'identity))
-                                         (cands (funcall sort (all-completions 
"" table pred))))
-                                    (cl-loop for cand in cands do (puthash 
cand plist ht))
-                                    cands))))
+                         (delq nil (cl-loop for (table . plist) in tables nconc
+                                            (let* ((pred (plist-get plist 
:predicate))
+                                                   (metadata 
(completion-metadata "" table pred))
+                                                   (sort (or 
(completion-metadata-get metadata 'display-sort-function)
+                                                             #'identity))
+                                                   (cands (funcall sort 
(all-completions "" table pred))))
+                                              (cl-loop for cell on cands do
+                                                       (if (eq (gethash (car 
cell) ht t) t)
+                                                           (puthash (car cell) 
plist ht)
+                                                         (setcar cell nil)))
+                                              cands)))))
                  (complete-with-action action candidates str pred))
                :sort nil :category 'cape-super)
               :exclusive 'no



reply via email to

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