[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/cape 21e44fee86 2/2: cape-capf-super: Add comments
|
From: |
ELPA Syncer |
|
Subject: |
[elpa] externals/cape 21e44fee86 2/2: cape-capf-super: Add comments |
|
Date: |
Fri, 19 Jan 2024 03:57:34 -0500 (EST) |
branch: externals/cape
commit 21e44fee862c96cd169ab715f0fb1e041c83afa0
Author: Daniel Mendler <mail@daniel-mendler.de>
Commit: Daniel Mendler <mail@daniel-mendler.de>
cape-capf-super: Add comments
---
cape.el | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)
diff --git a/cape.el b/cape.el
index 19fd78fe0c..c82407313d 100644
--- a/cape.el
+++ b/cape.el
@@ -902,12 +902,18 @@ The functions `cape-wrap-super' and `cape-capf-super' are
experimental."
(sort (or (completion-metadata-get md
'display-sort-function)
#'identity))
(cands (funcall sort (all-completions str
table pr))))
+ ;; Handle duplicates with a hash table.
(cl-loop
for cand in-ref cands
- for other = (gethash cand ht t) do
+ for dup = (gethash cand ht t) do
(cond
- ((eq other t) (puthash cand plist ht))
- ((not (equal other plist))
+ ((eq dup t)
+ ;; Candidate does not yet exist.
+ (puthash cand plist ht))
+ ((not (equal dup plist))
+ ;; Duplicate candidate. Candidate plist is
+ ;; different, therefore disambiguate the
+ ;; candidates.
(setf cand (propertize cand 'cape-capf-super
(cons cand plist))))))
(push cands candidates)))