summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Mendler <mail@daniel-mendler.de>2026-04-19 20:08:22 +0200
committerDaniel Mendler <mail@daniel-mendler.de>2026-04-19 20:08:22 +0200
commit1466f6f7effc0a783c8acda66471be0db11f789a (patch)
tree6ff7f5173530d5a60f95c24914519526884cd372
parentd86f5aa5d1e2ad3be153285c598458435b95b460 (diff)
Improve corfu--move-to-front
-rw-r--r--corfu.el11
1 files changed, 5 insertions, 6 deletions
diff --git a/corfu.el b/corfu.el
index 97d05ca..026282a 100644
--- a/corfu.el
+++ b/corfu.el
@@ -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."