From 249f6702e99343aac045697178e319784aacd2f0 Mon Sep 17 00:00:00 2001 From: Daniel Mendler Date: Fri, 19 Jan 2024 07:23:46 +0100 Subject: cape-capf-super: Improve deduplication (Fix #103, #104) --- cape.el | 10 ++++++---- 1 file 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)))) -- cgit v1.0