diff options
| author | Daniel Mendler <mail@daniel-mendler.de> | 2026-04-19 20:08:22 +0200 |
|---|---|---|
| committer | Daniel Mendler <mail@daniel-mendler.de> | 2026-04-19 20:08:22 +0200 |
| commit | 1466f6f7effc0a783c8acda66471be0db11f789a (patch) | |
| tree | 6ff7f5173530d5a60f95c24914519526884cd372 | |
| parent | d86f5aa5d1e2ad3be153285c598458435b95b460 (diff) | |
Improve corfu--move-to-front
| -rw-r--r-- | corfu.el | 11 |
1 files changed, 5 insertions, 6 deletions
@@ -536,12 +536,11 @@ FRAME is the existing frame." (run-at-time 0 nil #'corfu--hide-frame-deferred frame)))))) (defun corfu--move-to-front (elem list) - "Move ELEM to front of LIST." - ;; In contrast to Vertico, this function handles duplicates. See also the - ;; special deduplication function `corfu--delete-dups' based on - ;; `equal-including-properties' - (nconc (cl-loop for x in list if (equal x elem) collect x) - (delete elem list))) + "Move all ELEM (also duplicates) to front of LIST." + (if (member elem list) + (nconc (cl-loop for x in list if (equal x elem) collect x) + (delete elem list)) + list)) (defun corfu--filter-completions (&rest args) "Compute all completions for ARGS with lazy highlighting." |
