[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/flx 5ab18c3101 024/182: fix over manipulation of strings
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/flx 5ab18c3101 024/182: fix over manipulation of strings |
Date: |
Tue, 13 Dec 2022 03:59:21 -0500 (EST) |
branch: elpa/flx
commit 5ab18c3101ae55f1331dadd9f30cf3aa15475d71
Author: Le Wang <le.wang@agworld.com.au>
Commit: Le Wang <le.wang@agworld.com.au>
fix over manipulation of strings
- the fix for bug 10994 caused Emacs to hang since modified string is
not "eq" original.
- reverse order of list as api expects
resolves #6
resolves #2
resolves #4
---
flx-ido.el | 54 +++++++++++++++++++++++++++++-------------------------
1 file changed, 29 insertions(+), 25 deletions(-)
diff --git a/flx-ido.el b/flx-ido.el
index 03cd36ff61..85daf10be7 100644
--- a/flx-ido.el
+++ b/flx-ido.el
@@ -13,7 +13,7 @@
;; Version: 0.1
;; Last-Updated:
;; By:
-;; Update #: 2
+;; Update #: 8
;; URL:
;; Keywords:
;; Compatibility:
@@ -69,30 +69,29 @@
(defun flx-ido-narrowed (query items)
"Get the value from `flx-ido-narrowed-matches-hash' with the
longest prefix match."
- (if (zerop (length query))
- (list t (flx-ido-undecorate items))
- (let (best-match
- exact
- res)
- (loop for key being the hash-key of flx-ido-narrowed-matches-hash
- do (when (and (>= (length query) (length key))
- (eq t
- (compare-strings query 0 (min (length query)
- (length key))
- key 0 nil))
- (> (length key) (length best-match)))
- (setq best-match key)
- (when (= (length key)
- (length query))
- (setq exact t)
- (return))))
- (setq res (cond (exact
- (gethash best-match flx-ido-narrowed-matches-hash))
- (best-match
- (flx-ido-undecorate (gethash best-match
flx-ido-narrowed-matches-hash)))
- (t
- (flx-ido-undecorate items))))
- (list exact res))))
+ (let (best-match
+ exact
+ res)
+ (loop for key being the hash-key of flx-ido-narrowed-matches-hash
+ do (when (and (>= (length query) (length key))
+ (eq t
+ (compare-strings query 0 (min (length query)
+ (length key))
+ key 0 nil))
+ (or (null best-match)
+ (> (length key) (length best-match))))
+ (setq best-match key)
+ (when (= (length key)
+ (length query))
+ (setq exact t)
+ (return))))
+ (setq res (cond (exact
+ (gethash best-match flx-ido-narrowed-matches-hash))
+ (best-match
+ (flx-ido-undecorate (gethash best-match
flx-ido-narrowed-matches-hash)))
+ (t
+ (flx-ido-undecorate items))))
+ (list exact res)))
(defun flx-ido-undecorate (strings)
(flx-ido-decorate strings t))
@@ -114,6 +113,11 @@
(defun flx-ido-match (query items)
"Better sorting for flx ido matching."
+ (when (and (equal "" query)
+ (not (gethash query flx-ido-narrowed-matches-hash)))
+ ;; original function reverses list.
+ (setq items (nreverse items))
+ (puthash query items flx-ido-narrowed-matches-hash))
(destructuring-bind (exact items)
(flx-ido-narrowed query items)
(if exact ; `ido-rotate' case is covered by exact
match
- [nongnu] elpa/flx abe1a77c02 081/182: Merge pull request #38 from artagnon/cl-lib, (continued)
- [nongnu] elpa/flx abe1a77c02 081/182: Merge pull request #38 from artagnon/cl-lib, ELPA Syncer, 2022/12/13
- [nongnu] elpa/flx 9200e27309 083/182: use "flex" filtering when collection too large, ELPA Syncer, 2022/12/13
- [nongnu] elpa/flx c85273a6e8 009/182: fix helm demo typo, ELPA Syncer, 2022/12/13
- [nongnu] elpa/flx 7110df04e2 005/182: update tests, ELPA Syncer, 2022/12/13
- [nongnu] elpa/flx fabca711e9 013/182: fix typo, ELPA Syncer, 2022/12/13
- [nongnu] elpa/flx dc739574ad 011/182: add helm demo without flx, ELPA Syncer, 2022/12/13
- [nongnu] elpa/flx 955772f489 029/182: optimize full-match boost, ELPA Syncer, 2022/12/13
- [nongnu] elpa/flx 0519734c5b 030/182: consider runs of capitals to be same word, ELPA Syncer, 2022/12/13
- [nongnu] elpa/flx e80bc0dea4 018/182: more ido optimizations, refactor out flx-propertize, ELPA Syncer, 2022/12/13
- [nongnu] elpa/flx a31814e5ef 031/182: update README to say alpha, ELPA Syncer, 2022/12/13
- [nongnu] elpa/flx 5ab18c3101 024/182: fix over manipulation of strings,
ELPA Syncer <=
- [nongnu] elpa/flx fd10bf595d 025/182: fix typo, ELPA Syncer, 2022/12/13
- [nongnu] elpa/flx af1010e4ad 035/182: Reverting "fix `ido-merge-work-directories`", ELPA Syncer, 2022/12/13
- [nongnu] elpa/flx 11f3fad14f 041/182: get complete cache key more smartly, ELPA Syncer, 2022/12/13
- [nongnu] elpa/flx c6601c7162 022/182: readme update, ELPA Syncer, 2022/12/13
- [nongnu] elpa/flx a13d654096 045/182: disable caching for files/dirs for now, ELPA Syncer, 2022/12/13
- [nongnu] elpa/flx 1f175f3c65 047/182: add comment about disabling ido faces, ELPA Syncer, 2022/12/13
- [nongnu] elpa/flx 222f60d28e 055/182: Merge pull request #18 from jschaf/master, ELPA Syncer, 2022/12/13
- [nongnu] elpa/flx 1d86d3bc09 052/182: cache clearing advice should be "before", ELPA Syncer, 2022/12/13
- [nongnu] elpa/flx a0de931381 048/182: bump version, ELPA Syncer, 2022/12/13
- [nongnu] elpa/flx 3b650d13f7 057/182: Merge pull request #23 from bbatsov/doc-improvements, ELPA Syncer, 2022/12/13