diff options
| author | Daniel Mendler <mail@daniel-mendler.de> | 2024-01-19 07:29:28 +0100 |
|---|---|---|
| committer | Daniel Mendler <mail@daniel-mendler.de> | 2024-01-19 07:29:28 +0100 |
| commit | 21e44fee862c96cd169ab715f0fb1e041c83afa0 (patch) | |
| tree | 6edd7eae7547e3766cd49a5dcbe4fc4113b48c4b | |
| parent | 249f6702e99343aac045697178e319784aacd2f0 (diff) | |
cape-capf-super: Add comments
| -rw-r--r-- | cape.el | 12 |
1 files changed, 9 insertions, 3 deletions
@@ -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))) |
