summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Mendler <mail@daniel-mendler.de>2021-11-29 23:10:09 +0100
committerDaniel Mendler <mail@daniel-mendler.de>2021-11-29 23:10:09 +0100
commite1e3b9732f01ac5d49da2a0cacd8dab7217c6fe4 (patch)
tree9e16a6cd8fa40572afbf3fd817f45e037a689352
parent134aa0fbfb8d78f3a1c49eb7b3dae62330b7238e (diff)
Delete consecutive duplicates
-rw-r--r--corfu.el11
1 files changed, 5 insertions, 6 deletions
diff --git a/corfu.el b/corfu.el
index c6267a9..f5ba9f6 100644
--- a/corfu.el
+++ b/corfu.el
@@ -579,12 +579,11 @@ A scroll bar is displayed from LO to LO+BAR."
;; since this breaks the special casing in the `completion-file-name-table' for `file-exists-p'
;; and `file-directory-p'.
(when completing-file (setq all (corfu--filter-files all)))
- (setq all (funcall (or (corfu--sort-function) #'identity) all))
- (unless (equal field "")
- (setq all (corfu--move-prefix-candidates-to-front field all))
- (when (and completing-file (not (string-suffix-p "/" field)))
- (setq all (corfu--move-to-front (concat field "/") all)))
- (setq all (corfu--move-to-front field all)))
+ (setq all (delete-consecutive-dups (funcall (or (corfu--sort-function) #'identity) all)))
+ (setq all (corfu--move-prefix-candidates-to-front field all))
+ (when (and completing-file (not (string-suffix-p "/" field)))
+ (setq all (corfu--move-to-front (concat field "/") all)))
+ (setq all (corfu--move-to-front field all))
(list base all (length all) hl corfu--metadata
;; Select the prompt when the input is a valid completion
;; and if it is not equal to the first candidate.