[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/flx f1851c8983 037/182: treat last *non-zero* segment as b
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/flx f1851c8983 037/182: treat last *non-zero* segment as basename |
Date: |
Tue, 13 Dec 2022 03:59:23 -0500 (EST) |
branch: elpa/flx
commit f1851c8983d3d8eeeec4506c2e9a01f9e349f70c
Author: Le Wang <le.wang@agworld.com.au>
Commit: Le Wang <le.wang@agworld.com.au>
treat last *non-zero* segment as basename
- for paths like "foo/", basename should be "foo"
fixes #12
---
flx.el | 9 +++++++--
tests/flx-test.el | 10 +++++++++-
2 files changed, 16 insertions(+), 3 deletions(-)
diff --git a/flx.el b/flx.el
index 3147999f3c..0588f2d072 100644
--- a/flx.el
+++ b/flx.el
@@ -13,7 +13,7 @@
;; Version: 0.1
;; Last-Updated:
;; By:
-;; Update #: 13
+;; Update #: 15
;; URL:
;; Keywords:
;; Compatibility:
@@ -169,11 +169,16 @@ See documentation for logic."
(loop for group in groups-alist
for index from separator-count downto 0
with last-group-limit = nil
+ with basepath-found = nil
do (let ((group-start (car group))
(word-count (cadr group))
;; this is the number of effective word groups
(words-length (length (cddr group)))
- (basepath-p (not last-group-limit)))
+ basepath-p)
+ (when (and (not (zerop words-length))
+ (not basepath-found))
+ (setq basepath-found t)
+ (setq basepath-p t))
(let (num)
(setq num
(if basepath-p
diff --git a/tests/flx-test.el b/tests/flx-test.el
index 23d8f12960..7283e584b9 100644
--- a/tests/flx-test.el
+++ b/tests/flx-test.el
@@ -13,7 +13,7 @@
;; Version: 0.1
;; Last-Updated:
;; By:
-;; Update #: 9
+;; Update #: 10
;; URL:
;; Keywords:
;; Compatibility:
@@ -360,6 +360,14 @@ substring can overpower abbreviation."
(should (= (car score1) (car score2)))))
+(ert-deftest flx-basepath-is-last-segment ()
+ "For a path like \"bar/foo/\" the basename should be foo"
+ (let* ((query "def")
+ (higher (flx-score "defuns/" query (flx-make-filename-cache)))
+ (lower (flx-score "sane-defaults.el" query
(flx-make-filename-cache))))
+ (should (> (car higher) (car lower)))))
+
+
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; flx-test.el ends here
- [nongnu] elpa/flx 2a816e25df 151/182: Add file misc/.nosearch, (continued)
- [nongnu] elpa/flx 2a816e25df 151/182: Add file misc/.nosearch, ELPA Syncer, 2022/12/13
- [nongnu] elpa/flx 4cf3f5ad45 059/182: Merge pull request #25 from bbatsov/improve-headers, ELPA Syncer, 2022/12/13
- [nongnu] elpa/flx 11422574e5 166/182: Merge pull request #106 from jcs-PR/badge, ELPA Syncer, 2022/12/13
- [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 <=
- [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, 2022/12/13
- [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