[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/flx bebf045684 062/182: gracefully handle large collection
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/flx bebf045684 062/182: gracefully handle large collections |
Date: |
Tue, 13 Dec 2022 03:59:29 -0500 (EST) |
branch: elpa/flx
commit bebf04568461f0af4311033663fbd21ca7a3ad5e
Author: Le Wang <le.wang@agworld.com.au>
Commit: Le Wang <le.wang@agworld.com.au>
gracefully handle large collections
fixes #24
---
flx-ido.el | 31 +++++++++++++++++++++----------
1 file changed, 21 insertions(+), 10 deletions(-)
diff --git a/flx-ido.el b/flx-ido.el
index e73ae64449..cc7edb4153 100644
--- a/flx-ido.el
+++ b/flx-ido.el
@@ -57,6 +57,10 @@
(require 'ido)
(require 'flx)
+(defcustom flx-ido-threshhold 6000
+ "flx will not kick in until collection is filtered below this size with
\"flex\"."
+ :group 'ido)
+
(defcustom flx-ido-use-faces t
"Use `flx-highlight-face' to indicate characters contributing to best score."
@@ -135,16 +139,23 @@ item, in which case, the ending items are deleted."
(mapcar 'car things))))
(defun flx-ido-match-internal (query items)
- (let* ((matches (loop for item in items
- for string = (if (consp item) (car item) item)
- for score = (flx-score string query flx-file-cache)
- if score
- collect (cons item score)
- into matches
- finally return matches)))
- (flx-ido-decorate (ido-delete-runs
- (sort matches
- (lambda (x y) (> (cadr x) (cadr y))))))))
+ (if (< (length items) flx-ido-threshhold)
+ (let* ((matches (loop for item in items
+ for string = (if (consp item) (car item) item)
+ for score = (flx-score string query flx-file-cache)
+ if score
+ collect (cons item score)
+ into matches
+ finally return matches)))
+ (flx-ido-decorate (ido-delete-runs
+ (sort matches
+ (lambda (x y) (> (cadr x) (cadr y)))))))
+ (let ((regexp (mapconcat 'identity (split-string query "" t) ".*")))
+ (loop for item in items
+ if (string-match regexp (if (consp item) (car item) item))
+ collect item
+ into matches
+ finally return matches))))
(defun flx-ido-key-for-query (query)
(concat ido-current-directory query))
- [nongnu] elpa/flx 647cb2f92f 168/182: Merge pull request #104 from phst/nocl, (continued)
- [nongnu] elpa/flx 647cb2f92f 168/182: Merge pull request #104 from phst/nocl, ELPA Syncer, 2022/12/13
- [nongnu] elpa/flx ae0981b253 156/182: Merge pull request #87 from spwhitton/apt-get, ELPA Syncer, 2022/12/13
- [nongnu] elpa/flx 29e3664b75 175/182: Bump version to 0.6.2, ELPA Syncer, 2022/12/13
- [nongnu] elpa/flx ed11b39577 178/182: No longer bind obsolete max-specpdl-size, ELPA Syncer, 2022/12/13
- [nongnu] elpa/flx 67379d0a01 036/182: 2nd try fix for `ido-merge-work-directories`, ELPA Syncer, 2022/12/13
- [nongnu] elpa/flx 01818a56ae 039/182: handle of cons cells in completion list, ELPA Syncer, 2022/12/13
- [nongnu] elpa/flx 3d15906942 019/182: move demo into misc, ELPA Syncer, 2022/12/13
- [nongnu] elpa/flx f1851c8983 037/182: treat last *non-zero* segment as basename, ELPA Syncer, 2022/12/13
- [nongnu] elpa/flx 482b887215 046/182: (BREAKING) activate through proper minor-mode, ELPA Syncer, 2022/12/13
- [nongnu] elpa/flx 451711cfeb 058/182: Improve comment headers, ELPA Syncer, 2022/12/13
- [nongnu] elpa/flx bebf045684 062/182: gracefully handle large collections,
ELPA Syncer <=
- [nongnu] elpa/flx 490412dcc9 061/182: Rename predicate functions according to Emacs Lisp style, ELPA Syncer, 2022/12/13
- [nongnu] elpa/flx 1c42be202d 071/182: Merge pull request #29 from bbatsov/marmalade, ELPA Syncer, 2022/12/13
- [nongnu] elpa/flx 638313b829 077/182: .gitignore: ignore emacs temporary files, ELPA Syncer, 2022/12/13
- [nongnu] elpa/flx 24dd436463 100/182: Fix compilation errors., ELPA Syncer, 2022/12/13
- [nongnu] elpa/flx b322b72d7b 131/182: async comes from melpa, ELPA Syncer, 2022/12/13
- [nongnu] elpa/flx 551b095274 130/182: fix travis cask path, ELPA Syncer, 2022/12/13
- [nongnu] elpa/flx 26a1225431 137/182: rename optimization test, ELPA Syncer, 2022/12/13
- [nongnu] elpa/flx 7a2601481c 142/182: Simplify flx-propertize, ELPA Syncer, 2022/12/13
- [nongnu] elpa/flx b95294518c 155/182: Debian and Ubuntu installation instructions, ELPA Syncer, 2022/12/13
- [nongnu] elpa/flx 46040d0b09 160/182: Merge pull request #97 from antmak/patch-1, ELPA Syncer, 2022/12/13