[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/flx 8605b4b421 026/182: don't do caching when reading file
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/flx 8605b4b421 026/182: don't do caching when reading file names |
Date: |
Tue, 13 Dec 2022 03:59:21 -0500 (EST) |
branch: elpa/flx
commit 8605b4b4212194e5e46805a36dd9ed2219cc2c2b
Author: Le Wang <le.wang@agworld.com.au>
Commit: Le Wang <le.wang@agworld.com.au>
don't do caching when reading file names
#3
---
flx-ido.el | 46 ++++++++++++++++++++++++++--------------------
1 file changed, 26 insertions(+), 20 deletions(-)
diff --git a/flx-ido.el b/flx-ido.el
index 2fd0193050..e25d25acb6 100644
--- a/flx-ido.el
+++ b/flx-ido.el
@@ -13,7 +13,7 @@
;; Version: 0.1
;; Last-Updated:
;; By:
-;; Update #: 9
+;; Update #: 12
;; URL:
;; Keywords:
;; Compatibility:
@@ -111,27 +111,33 @@
(nthcdr decorate-count things)
(mapcar 'car (nthcdr decorate-count things))))))
+(defun flx-ido-match-internal (query items)
+ (let* ((matches (loop for item in items
+ for score = (flx-score item query flx-file-cache)
+ if score
+ collect (cons item score)
+ into matches
+ finally return matches)))
+ (flx-ido-decorate (sort matches
+ (lambda (x y) (> (cadr x) (cadr y)))))))
+
(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
- items
- (let* ((matches (loop for item in items
- for score = (flx-score item query flx-file-cache)
- if score
- collect (cons item score)
- into matches
- finally return matches))
- res)
- (setq res (flx-ido-decorate (sort matches
- (lambda (x y) (> (cadr x) (cadr
y))))))
- (puthash query res flx-ido-narrowed-matches-hash)))))
+ (if (memq ido-cur-item '(file dir))
+ (if (equal "" query)
+ (nreverse 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))
+ (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
+ items
+ (puthash query (flx-ido-match-internal query items)
+ flx-ido-narrowed-matches-hash)))))
(defvar flx-ido-use t
"Use flx matching for ido.")
- [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, 2022/12/13
- [nongnu] elpa/flx 8605b4b421 026/182: don't do caching when reading file names,
ELPA Syncer <=
- [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
- [nongnu] elpa/flx 2b31df9ed0 140/182: Make dynamic programming test even more "difficult", ELPA Syncer, 2022/12/13