[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/flx 4d625bdfb9 135/182: Test score before building possibl
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/flx 4d625bdfb9 135/182: Test score before building possible match |
Date: |
Tue, 13 Dec 2022 03:59:37 -0500 (EST) |
branch: elpa/flx
commit 4d625bdfb92f12738f12606ad869a26f2020e66e
Author: PythonNut <PythonNut@users.noreply.github.com>
Commit: PythonNut <PythonNut@users.noreply.github.com>
Test score before building possible match
---
flx.el | 45 ++++++++++++++++++++++++++-------------------
1 file changed, 26 insertions(+), 19 deletions(-)
diff --git a/flx.el b/flx.el
index 0d5640bb03..77f3d3477b 100644
--- a/flx.el
+++ b/flx.el
@@ -245,7 +245,13 @@ See documentation for logic."
(puthash str res cache))
res))))
-(defun flx-get-matches-worker (greater-than q-index query-length heatmap
match-cache str-info query)
+(defun flx-get-matches-worker (greater-than
+ q-index
+ query-length
+ heatmap
+ match-cache
+ str-info
+ query)
(let ((hash-key (+ q-index
(* (or greater-than 0)
query-length))))
@@ -260,28 +266,29 @@ See documentation for logic."
(mapcar (lambda (index)
(cons (list index)
(cons (aref heatmap index) 0))) indexes)
- (let ((match) (best-score most-negative-fixnum))
+ (let ((match)
+ (score)
+ (best-score most-negative-fixnum))
(dolist (index indexes (and match (list match)))
(dolist (elem (flx-get-matches-worker index (1+ q-index)
query-length heatmap
match-cache str-info query))
- (setq elem
- (cons (cons index (car elem))
- (cons
- (+ (cadr elem)
- (aref heatmap index)
- (if (= (1- (caar elem)) index)
- (+ (* (min (cddr elem)
- 3)
- 15)
- 60)
- 0))
- (if (= (1- (caar elem)) index)
- (1+ (cddr elem))
- 0))))
+ (setq score (+ (cadr elem)
+ (aref heatmap index)
+ (if (= (1- (caar elem)) index)
+ (+ (* (min (cddr elem)
+ 3)
+ 15)
+ 60)
+ 0)))
+
;; we only care about the optimal score
- (when (> (cadr elem) best-score)
- (setq best-score (cadr elem)
- match elem)))))))
+ (when (> score best-score)
+ (setq best-score score
+ match (cons (cons index (car elem))
+ (cons score
+ (if (= (1- (caar elem)) index)
+ (1+ (cddr elem))
+ 0))))))))))
match-cache))))
(defun flx-score (str query &optional cache)
- [nongnu] elpa/flx a59c08283d 110/182: Simplify caching, implement own flex., (continued)
- [nongnu] elpa/flx a59c08283d 110/182: Simplify caching, implement own flex., ELPA Syncer, 2022/12/13
- [nongnu] elpa/flx 3032920883 117/182: Fix search results changing positions as you type., ELPA Syncer, 2022/12/13
- [nongnu] elpa/flx 46a1b29482 118/182: Merge pull request #62 from bsuh/fix61, ELPA Syncer, 2022/12/13
- [nongnu] elpa/flx 5fe7f8a94a 121/182: Add algorithmic optimizations, ELPA Syncer, 2022/12/13
- [nongnu] elpa/flx b9c2d42b67 122/182: Remove deprecated tests, ELPA Syncer, 2022/12/13
- [nongnu] elpa/flx 41842ff7b3 123/182: Small performance tweaks, ELPA Syncer, 2022/12/13
- [nongnu] elpa/flx 9c8a17f199 127/182: cadar -> cl-cadar, ELPA Syncer, 2022/12/13
- [nongnu] elpa/flx ba2a503873 128/182: use Cask to manage deps, ELPA Syncer, 2022/12/13
- [nongnu] elpa/flx 279179b5af 133/182: travis show pwd, ELPA Syncer, 2022/12/13
- [nongnu] elpa/flx 321efc25da 132/182: fix Makefile circular dependency, ELPA Syncer, 2022/12/13
- [nongnu] elpa/flx 4d625bdfb9 135/182: Test score before building possible match,
ELPA Syncer <=
- [nongnu] elpa/flx a9f26b2840 138/182: Fix caching of nil, ELPA Syncer, 2022/12/13
- [nongnu] elpa/flx aba36b564e 139/182: Rename flx-get-matches-worker, ELPA Syncer, 2022/12/13
- [nongnu] elpa/flx 20e3fe8595 141/182: Make flx word separators customizable, ELPA Syncer, 2022/12/13
- [nongnu] elpa/flx 8959c45907 147/182: Bump version, ELPA Syncer, 2022/12/13
- [nongnu] elpa/flx 20e3073352 148/182: Merge pull request #78 from lewang/0.6, ELPA Syncer, 2022/12/13
- [nongnu] elpa/flx dd4b4d50da 149/182: Hotfix: Raise recursion limits dynamically, fixes #79, ELPA Syncer, 2022/12/13
- [nongnu] elpa/flx 77e82ddd21 150/182: Move definition of flx-ido-mode to appease byte-compiler, ELPA Syncer, 2022/12/13
- [nongnu] elpa/flx 7fce6a4cdb 153/182: Bump version, ELPA Syncer, 2022/12/13
- [nongnu] elpa/flx d633b6e14a 157/182: Set custom type of options, ELPA Syncer, 2022/12/13
- [nongnu] elpa/flx 9c5cb5de02 158/182: Merge pull request #95 from emacsjanitors/silencio, ELPA Syncer, 2022/12/13