[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/flx 64b8e0f934 027/182: work around ido bug 10994
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/flx 64b8e0f934 027/182: work around ido bug 10994 |
Date: |
Tue, 13 Dec 2022 03:59:21 -0500 (EST) |
branch: elpa/flx
commit 64b8e0f9340891f3e655d57cc50e06475ecb85cc
Author: Le Wang <le.wang@agworld.com.au>
Commit: Le Wang <le.wang@agworld.com.au>
work around ido bug 10994
- delete runs of same string in completion
---
flx-ido.el | 30 +++++++++++++++++++++++++-----
1 file changed, 25 insertions(+), 5 deletions(-)
diff --git a/flx-ido.el b/flx-ido.el
index e25d25acb6..a8bea9df0d 100644
--- a/flx-ido.el
+++ b/flx-ido.el
@@ -13,7 +13,7 @@
;; Version: 0.1
;; Last-Updated:
;; By:
-;; Update #: 12
+;; Update #: 15
;; URL:
;; Keywords:
;; Compatibility:
@@ -64,6 +64,25 @@
(require 'ido)
(require 'flx)
+(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))
+
(defvar flx-ido-narrowed-matches-hash (make-hash-table :test 'equal))
(defun flx-ido-narrowed (query items)
@@ -118,19 +137,20 @@
collect (cons item score)
into matches
finally return matches)))
- (flx-ido-decorate (sort matches
- (lambda (x y) (> (cadr x) (cadr y)))))))
+ (flx-ido-decorate (ido-delete-runs
+ (sort matches
+ (lambda (x y) (> (cadr x) (cadr y))))))))
(defun flx-ido-match (query items)
"Better sorting for flx ido matching."
(if (memq ido-cur-item '(file dir))
(if (equal "" query)
- (nreverse items)
+ (nreverse (ido-delete-runs items))
(flx-ido-match-internal query items))
(when (and (equal "" query)
(not (gethash query flx-ido-narrowed-matches-hash)))
;; original function reverses list.
- (setq items (nreverse items))
+ (setq items (nreverse (ido-delete-runs items)))
(puthash query items flx-ido-narrowed-matches-hash))
(destructuring-bind (exact items)
(flx-ido-narrowed query items)
- [nongnu] branch elpa/flx created (now 7b44a5abb2), ELPA Syncer, 2022/12/13
- [nongnu] elpa/flx 331ef6f109 001/182: first commit, ELPA Syncer, 2022/12/13
- [nongnu] elpa/flx 2348893f90 012/182: flx-ido always use filename cache, ELPA Syncer, 2022/12/13
- [nongnu] elpa/flx 387d1ee048 008/182: update ido implementation with ido demo, ELPA Syncer, 2022/12/13
- [nongnu] elpa/flx 47ef1bf377 006/182: update license, ELPA Syncer, 2022/12/13
- [nongnu] elpa/flx 9fec96087b 010/182: fix sort modifying list by side-effect bug, ELPA Syncer, 2022/12/13
- [nongnu] elpa/flx d295ba6a2f 007/182: add test list, ELPA Syncer, 2022/12/13
- [nongnu] elpa/flx b1702e2aa1 054/182: Add colon to non-word characters., ELPA Syncer, 2022/12/13
- [nongnu] elpa/flx 5a23bc7da3 003/182: update tests, ELPA Syncer, 2022/12/13
- [nongnu] elpa/flx 64b8e0f934 027/182: work around ido bug 10994,
ELPA Syncer <=
- [nongnu] elpa/flx 8605b4b421 026/182: don't do caching when reading file names, ELPA Syncer, 2022/12/13
- [nongnu] elpa/flx 8849b39816 066/182: Make flx-capital-p behave correctly for non-latin words, ELPA Syncer, 2022/12/13
- [nongnu] elpa/flx ad87db4348 068/182: Make flx-ido depend on flx on package level, ELPA Syncer, 2022/12/13
- [nongnu] elpa/flx 225fae97c9 070/182: Mention Marmalade in the README, ELPA Syncer, 2022/12/13
- [nongnu] elpa/flx 43f78d4815 090/182: Touch-up commentary., ELPA Syncer, 2022/12/13
- [nongnu] elpa/flx dd428a8cc6 095/182: Add some debug statements., ELPA Syncer, 2022/12/13
- [nongnu] elpa/flx 3054a8038d 112/182: Fix typo in README.md, ELPA Syncer, 2022/12/13
- [nongnu] elpa/flx f0c3157268 114/182: Increase default flx-ido-threshold to 6000, ELPA Syncer, 2022/12/13
- [nongnu] elpa/flx f5fda2897f 125/182: enable lexical-binding, ELPA Syncer, 2022/12/13
- [nongnu] elpa/flx 3cd3bf7687 129/182: add perf test-case, ELPA Syncer, 2022/12/13