summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Mendler <mail@daniel-mendler.de>2024-01-19 07:23:46 +0100
committerDaniel Mendler <mail@daniel-mendler.de>2024-01-19 07:23:46 +0100
commit249f6702e99343aac045697178e319784aacd2f0 (patch)
tree6436d5e16a9cb3ec053555b6bab9ac75eac96ac5
parentf021305d20a40021058fdd31f9acddc86e463eaf (diff)
cape-capf-super: Improve deduplication (Fix #103, #104)
-rw-r--r--cape.el10
1 files changed, 6 insertions, 4 deletions
diff --git a/cape.el b/cape.el
index e1e2875..19fd78f 100644
--- a/cape.el
+++ b/cape.el
@@ -903,11 +903,13 @@ The functions `cape-wrap-super' and `cape-capf-super' are experimental."
#'identity))
(cands (funcall sort (all-completions str table pr))))
(cl-loop
- for cand in-ref cands do
- (if (eq (gethash cand ht t) t)
- (puthash cand plist ht)
+ for cand in-ref cands
+ for other = (gethash cand ht t) do
+ (cond
+ ((eq other t) (puthash cand plist ht))
+ ((not (equal other plist))
(setf cand (propertize cand 'cape-capf-super
- (cons cand plist)))))
+ (cons cand plist))))))
(push cands candidates)))
(setq cand-ht ht)
(apply #'nconc (nreverse candidates))))