[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/flx df036210c6 098/182: Switch to 24.4 delete dup runs alg
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/flx df036210c6 098/182: Switch to 24.4 delete dup runs algorithm. |
Date: |
Tue, 13 Dec 2022 03:59:34 -0500 (EST) |
branch: elpa/flx
commit df036210c6c3d129b3511cda1ee27b3549439c23
Author: Le Wang <le.wang@agworld.com.au>
Commit: Le Wang <le.wang@agworld.com.au>
Switch to 24.4 delete dup runs algorithm.
- delete-consecutive-dups
---
flx-ido.el | 39 +++++++++++++++++++--------------------
1 file changed, 19 insertions(+), 20 deletions(-)
diff --git a/flx-ido.el b/flx-ido.el
index 2ae2d0a3fb..fc248e2ebe 100644
--- a/flx-ido.el
+++ b/flx-ido.el
@@ -70,24 +70,22 @@
"Use `flx-highlight-face' to indicate characters contributing to best score."
:group 'ido)
-(unless (fboundp 'ido-delete-runs)
- (defun ido-delete-runs (list)
- "Delete consecutive runs of same item in list.
-Comparison done with `equal'. Runs may loop back on to the first
-item, in which case, the ending items are deleted."
- (let ((tail list)
- before-last-run)
- (while tail
- (if (consp (cdr tail))
- (if (equal (car tail) (cadr tail))
- (setcdr tail (cddr tail))
- (setq before-last-run tail)
- (setq tail (cdr tail)))
- (setq tail (cdr tail))))
- (when (and before-last-run
- (equal (car list) (cadr before-last-run)))
- (setcdr before-last-run nil)))
- list))
+(unless (fboundp 'delete-consecutive-dups)
+ (defun delete-consecutive-dups (list &optional circular)
+ "Destructively remove `equal' consecutive duplicates from LIST.
+First and last elements are considered consecutive if CIRCULAR is
+non-nil."
+ (let ((tail list) last)
+ (while (consp tail)
+ (if (equal (car tail) (cadr tail))
+ (setcdr tail (cddr tail))
+ (setq last (car tail)
+ tail (cdr tail))))
+ (if (and circular
+ (cdr list)
+ (equal last (car list)))
+ (nbutlast list)
+ list))))
(defvar flx-ido-narrowed-matches-hash (make-hash-table :test 'equal)
"Key is a query string. Value is a list of narrowed matches.")
@@ -165,9 +163,10 @@ item, in which case, the ending items are deleted."
collect (cons item score)
into matches
finally return matches)))
- (flx-ido-decorate (ido-delete-runs
+ (flx-ido-decorate (delete-consecutive-dups
(sort matches
- (lambda (x y) (> (cadr x) (cadr y))))))))
+ (lambda (x y) (> (cadr x) (cadr y))))
+ t))))
(defun flx-ido-key-for-query (query)
(concat ido-current-directory query))
- [nongnu] elpa/flx 4cd6d9c9e4 078/182: flx: require cl-lib; avoid ugly eval-when-compile, (continued)
- [nongnu] elpa/flx 4cd6d9c9e4 078/182: flx: require cl-lib; avoid ugly eval-when-compile, ELPA Syncer, 2022/12/13
- [nongnu] elpa/flx 569beec178 080/182: Merge pull request #39 from artagnon/minor-cleanups, ELPA Syncer, 2022/12/13
- [nongnu] elpa/flx 2903e5d2a7 084/182: Merge pull request #42 from bbatsov/byte-compile-warning, ELPA Syncer, 2022/12/13
- [nongnu] elpa/flx 9440288782 086/182: Refactor to make prefix match clear., ELPA Syncer, 2022/12/13
- [nongnu] elpa/flx a1fef07104 087/182: Fix C-k to kill buffer at head., ELPA Syncer, 2022/12/13
- [nongnu] elpa/flx 12589211c6 088/182: Implement case-fold searching, ELPA Syncer, 2022/12/13
- [nongnu] elpa/flx 80bb88c32f 092/182: Clean test .elcs but never compile them., ELPA Syncer, 2022/12/13
- [nongnu] elpa/flx 5591055c33 093/182: Recommend enabling ido-flex., ELPA Syncer, 2022/12/13
- [nongnu] elpa/flx 48ebd6c857 094/182: Make prefix-matchine one way., ELPA Syncer, 2022/12/13
- [nongnu] elpa/flx 1f46d67762 096/182: Update big list experiment., ELPA Syncer, 2022/12/13
- [nongnu] elpa/flx df036210c6 098/182: Switch to 24.4 delete dup runs algorithm.,
ELPA Syncer <=
- [nongnu] elpa/flx 3fdaea3ec7 097/182: Respecting flx-ido-threshhold., ELPA Syncer, 2022/12/13
- [nongnu] elpa/flx 3d631fdd38 101/182: Improve behaviour backspacing flx -> flex., ELPA Syncer, 2022/12/13
- [nongnu] elpa/flx c75f14fbc2 104/182: Fix docstring bugs from checkdoc., ELPA Syncer, 2022/12/13
- [nongnu] elpa/flx 6797797426 105/182: Update status in README.md., ELPA Syncer, 2022/12/13
- [nongnu] elpa/flx a154058007 108/182: Use ido's name canonicalization., ELPA Syncer, 2022/12/13
- [nongnu] elpa/flx acd4334893 109/182: Increase threshold to 2000., ELPA Syncer, 2022/12/13
- [nongnu] elpa/flx a59c08283d 110/182: Simplify caching, implement own flex., ELPA Syncer, 2022/12/13
- [nongnu] elpa/flx 3032920883 117/182: Fix search results changing positions as you type., ELPA Syncer, 2022/12/13
- [nongnu] elpa/flx 46a1b29482 118/182: Merge pull request #62 from bsuh/fix61, ELPA Syncer, 2022/12/13
- [nongnu] elpa/flx 5fe7f8a94a 121/182: Add algorithmic optimizations, ELPA Syncer, 2022/12/13