[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/flx e2ed4ea0a7 113/182: Make flex search match case-foldin
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/flx e2ed4ea0a7 113/182: Make flex search match case-folding behaviour of flx-ido. |
Date: |
Tue, 13 Dec 2022 03:59:35 -0500 (EST) |
branch: elpa/flx
commit e2ed4ea0a777f9ccc6f0f4ee3163641f0586c310
Author: Le Wang <le.wang@agworld.com.au>
Commit: Le Wang <le.wang@agworld.com.au>
Make flex search match case-folding behaviour of flx-ido.
---
flx-ido.el | 21 +++++++++++++++------
1 file changed, 15 insertions(+), 6 deletions(-)
diff --git a/flx-ido.el b/flx-ido.el
index 17d6a3cb45..5cfe9e7aaf 100644
--- a/flx-ido.el
+++ b/flx-ido.el
@@ -205,17 +205,26 @@ If filtered item count is still greater than
`flx-ido-threshold', then use flex.
res-items
(flx-ido-match-internal query res-items)))))
+(defun flx-ido-query-to-regexp (query)
+ "Convert QUERY to flx style case folding regexp."
+ (let* ((breakdown-str (mapcar (lambda (c)
+ (apply 'string c (when (= (downcase c) c)
+ (list (upcase c)))))
+ query))
+ (re (concat (format "[%s]" (nth 0 breakdown-str))
+ (mapconcat (lambda (c)
+ (format "[^%s]*[%s]" c c))
+ (cdr breakdown-str) ""))))
+ re))
+
(defun flx-flex-match (query items)
"Reimplement ido's flex matching.
Our implementation always uses flex and doesn't care about substring matches."
(if (zerop (length query))
items
- (let ((re (concat (regexp-quote (string (aref query 0)))
- (mapconcat (lambda (c)
- (concat "[^" (string c) "]*"
- (regexp-quote (string c))))
- (substring query 1) "")))
- matches)
+ (let* ((case-fold-search nil)
+ (re (flx-ido-query-to-regexp query))
+ matches)
(mapc
(lambda (item)
(let ((name (ido-name item)))
- [nongnu] elpa/flx 7017d8416b 163/182: Add LICENSE file., (continued)
- [nongnu] elpa/flx 7017d8416b 163/182: Add LICENSE file., ELPA Syncer, 2022/12/13
- [nongnu] elpa/flx e5c0680ebf 165/182: Add badges to README., ELPA Syncer, 2022/12/13
- [nongnu] elpa/flx f589b237b8 172/182: Add a proper library commentary, ELPA Syncer, 2022/12/13
- [nongnu] elpa/flx a62e3dd974 176/182: Add missing license statements, ELPA Syncer, 2022/12/13
- [nongnu] elpa/flx 5c23a9e87d 180/182: Merge pull request #114 from tarsiiformes/silencio, ELPA Syncer, 2022/12/13
- [nongnu] elpa/flx 9076fb87af 091/182: Add commentary about using uppercase., ELPA Syncer, 2022/12/13
- [nongnu] elpa/flx 2b54391aa6 119/182: Fix helm demo with `.` in query., ELPA Syncer, 2022/12/13
- [nongnu] elpa/flx c3229e0075 134/182: cask install into project root, ELPA Syncer, 2022/12/13
- [nongnu] elpa/flx b340205929 143/182: Tidy up docstrings, ELPA Syncer, 2022/12/13
- [nongnu] elpa/flx 813e56a014 115/182: Stabilise search results when scores are equal., ELPA Syncer, 2022/12/13
- [nongnu] elpa/flx e2ed4ea0a7 113/182: Make flex search match case-folding behaviour of flx-ido.,
ELPA Syncer <=
- [nongnu] elpa/flx 10db531369 120/182: Remove spurious space., ELPA Syncer, 2022/12/13
- [nongnu] elpa/flx 3f567a4741 126/182: back out clojure style `<`, ELPA Syncer, 2022/12/13
- [nongnu] elpa/flx 72c9ea0045 082/182: Fix a byte compilation warning, ELPA Syncer, 2022/12/13
- [nongnu] elpa/flx 502e01673a 106/182: Bump version to 0.3, ELPA Syncer, 2022/12/13
- [nongnu] elpa/flx b96f2c3e1d 152/182: Merge pull request #80 from tarsius/silencio, ELPA Syncer, 2022/12/13
- [nongnu] elpa/flx 82d647a5c6 159/182: Fix incorrect markup in the readme, ELPA Syncer, 2022/12/13
- [nongnu] elpa/flx 836d5917a3 161/182: Fix typos, ELPA Syncer, 2022/12/13
- [nongnu] elpa/flx 17f5c9cb2a 162/182: Merge pull request #102 from tarsiiformes/typos, ELPA Syncer, 2022/12/13
- [nongnu] elpa/flx c7e8574da3 171/182: Shorten long lines, ELPA Syncer, 2022/12/13
- [nongnu] elpa/flx 1be7b124a2 181/182: Merge pull request #110 from skangas/license-fixes, ELPA Syncer, 2022/12/13