[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/flx a15638e403 064/182: Merge pull request #26 from bbatso
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/flx a15638e403 064/182: Merge pull request #26 from bbatsov/master |
Date: |
Tue, 13 Dec 2022 03:59:29 -0500 (EST) |
branch: elpa/flx
commit a15638e40351f50b9dbbd61120fc9e24112d183b
Merge: f9bd16221b 490412dcc9
Author: Le Wang <l26wang@gmail.com>
Commit: Le Wang <l26wang@gmail.com>
Merge pull request #26 from bbatsov/master
Update a few predicate functions according to the common Emacs Lisp style
---
flx.el | 27 +++++++++++----------
tests/flx-test.el | 70 ++++++++++++++++++++-----------------------------------
2 files changed, 40 insertions(+), 57 deletions(-)
diff --git a/flx.el b/flx.el
index 6cfef3b1fa..a81bbec60e 100644
--- a/flx.el
+++ b/flx.el
@@ -70,23 +70,26 @@
res))
;;; Do we need more word separators than ST?
-(defsubst flx-is-word (char)
- "returns t if char is word"
+(defsubst flx-word-p (char)
+ "Check if CHAR is a word character."
(and char
(not (memq char '(?\ ?- ?_ ?: ?. ?/ ?\\)))))
-(defsubst flx-is-capital (char)
- "returns t if char is word"
+(defsubst flx-capital-p (char)
+ "Check if CHAR is an uppercase character."
(and char
(and (<= char ?Z)
(<= ?A char))))
-(defsubst flx-is-boundary (last-char char)
+(defsubst flx-boundary-p (last-char char)
+ "Check is LAST-CHAR is the end of a word and CHAR the start of the next.
+
+The function is camel-case aware."
(or (null last-char)
- (and (not (flx-is-capital last-char))
- (flx-is-capital char))
- (and (not (flx-is-word last-char))
- (flx-is-word char))))
+ (and (not (flx-capital-p last-char))
+ (flx-capital-p char))
+ (and (not (flx-word-p last-char))
+ (flx-word-p char))))
(defsubst flx-inc-vec (vec &optional inc beg end)
"increment each element of vectory by INC(default=1)
@@ -127,10 +130,10 @@ See documentation for logic."
;; considered words of length 1. This is so "foo/__ab"
;; gets penalized compared to "foo/ab".
(if (zerop group-word-count) nil last-char)))
- (when (flx-is-boundary effective-last-char char)
+ (when (flx-boundary-p effective-last-char char)
(setcdr (cdar groups-alist) (cons index (cddar
groups-alist))))
- (when (and (not (flx-is-word last-char))
- (flx-is-word char))
+ (when (and (not (flx-word-p last-char))
+ (flx-word-p char))
(incf group-word-count)))
;; ++++ -45 penalize extension
(when (eq last-char penalty-lead)
diff --git a/tests/flx-test.el b/tests/flx-test.el
index 7283e584b9..4081a56870 100644
--- a/tests/flx-test.el
+++ b/tests/flx-test.el
@@ -1,37 +1,17 @@
-;;; flx-test.el ---
+;;; flx-test.el --- flx ert unit tests
-;; this file is not part of Emacs
+;; Copyright © 2013 Le Wang
-;; Copyright (C) 2013 Le Wang
;; Author: Le Wang
;; Maintainer: Le Wang
-;; Description:
-;; Author: Le Wang
-;; Maintainer: Le Wang
-
+;; Description: fuzzy matching with good sorting
;; Created: Tue Apr 16 23:32:32 2013 (+0800)
-;; Version: 0.1
-;; Last-Updated:
-;; By:
-;; Update #: 10
-;; URL:
-;; Keywords:
-;; Compatibility:
-
-;;; Installation:
-
-;;
-;;
-;;
+;; URL: https://github.com/lewang/flx
-;;; Commentary:
+;; This file is NOT part of GNU Emacs.
-;;
-;;
-;;
+;;; License
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-;;
;; This program is free software; you can redistribute it and/or
;; modify it under the terms of the GNU General Public License as
;; published by the Free Software Foundation; either version 3, or
@@ -46,8 +26,8 @@
;; along with this program; see the file COPYING. If not, write to
;; the Free Software Foundation, Inc., 51 Franklin Street, Fifth
;; Floor, Boston, MA 02110-1301, USA.
-;;
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+
+;;; Commentary:
;;; Code:
@@ -70,23 +50,23 @@
h)
(should (= 3 count))))
-(ert-deftest flx-is-boundary ()
- (should (flx-is-boundary ?/ ?a))
- (should (flx-is-boundary nil ?a))
- (should-not (flx-is-boundary ?a ?/))
- (should (flx-is-boundary ?/ ?A))
- (should (flx-is-boundary ?a ?A)))
-
-(ert-deftest flx-is-capital ()
- (should (flx-is-capital ?A))
- (should (flx-is-capital ?Z))
- (should-not (flx-is-capital ?_))
- (should-not (flx-is-capital ?a)))
-
-(ert-deftest flx-is-word ()
- (should (flx-is-word ?a))
- (should (flx-is-word ?A))
- (should-not (flx-is-word ?_)))
+(ert-deftest flx-boundary-p ()
+ (should (flx-boundary-p ?/ ?a))
+ (should (flx-boundary-p nil ?a))
+ (should-not (flx-boundary-p ?a ?/))
+ (should (flx-boundary-p ?/ ?A))
+ (should (flx-boundary-p ?a ?A)))
+
+(ert-deftest flx-capital-p ()
+ (should (flx-capital-p ?A))
+ (should (flx-capital-p ?Z))
+ (should-not (flx-capital-p ?_))
+ (should-not (flx-capital-p ?a)))
+
+(ert-deftest flx-word-p ()
+ (should (flx-word-p ?a))
+ (should (flx-word-p ?A))
+ (should-not (flx-word-p ?_)))
(ert-deftest flx-inc-vec ()
"roll and unroll should be bring back original score"
- [nongnu] elpa/flx 1f175f3c65 047/182: add comment about disabling ido faces, (continued)
- [nongnu] elpa/flx 1f175f3c65 047/182: add comment about disabling ido faces, ELPA Syncer, 2022/12/13
- [nongnu] elpa/flx 222f60d28e 055/182: Merge pull request #18 from jschaf/master, ELPA Syncer, 2022/12/13
- [nongnu] elpa/flx 1d86d3bc09 052/182: cache clearing advice should be "before", ELPA Syncer, 2022/12/13
- [nongnu] elpa/flx a0de931381 048/182: bump version, ELPA Syncer, 2022/12/13
- [nongnu] elpa/flx 3b650d13f7 057/182: Merge pull request #23 from bbatsov/doc-improvements, ELPA Syncer, 2022/12/13
- [nongnu] elpa/flx f3ccfc9168 049/182: make warning less dramatic, ELPA Syncer, 2022/12/13
- [nongnu] elpa/flx acf230e2c9 102/182: Lower default flx-ido-threshold -> 500., ELPA Syncer, 2022/12/13
- [nongnu] elpa/flx a1ac8f97ec 034/182: fix `ido-merge-work-directories`, ELPA Syncer, 2022/12/13
- [nongnu] elpa/flx f068b2bc1f 056/182: Improve the formatting of the README and extend it a bit, ELPA Syncer, 2022/12/13
- [nongnu] elpa/flx 1df93b286a 060/182: comment clarification, ELPA Syncer, 2022/12/13
- [nongnu] elpa/flx a15638e403 064/182: Merge pull request #26 from bbatsov/master,
ELPA Syncer <=
- [nongnu] elpa/flx c41f9f5087 065/182: reorder README sections, ELPA Syncer, 2022/12/13
- [nongnu] elpa/flx d77b703c37 069/182: Merge pull request #28 from bbatsov/marmalade, ELPA Syncer, 2022/12/13
- [nongnu] elpa/flx 0c41fc616d 072/182: update package install instrucations, ELPA Syncer, 2022/12/13
- [nongnu] elpa/flx ce2d375f82 073/182: Makefile: introduce all, clean targets, ELPA Syncer, 2022/12/13
- [nongnu] elpa/flx e24352a502 074/182: add usage information, ELPA Syncer, 2022/12/13
- [nongnu] elpa/flx 6800cc34a9 076/182: flx-ido: fix comment in advice for ido-set-matches-1, ELPA Syncer, 2022/12/13
- [nongnu] elpa/flx 4cd6d9c9e4 078/182: flx: require cl-lib; avoid ugly eval-when-compile, ELPA Syncer, 2022/12/13
- [nongnu] elpa/flx 569beec178 080/182: Merge pull request #39 from artagnon/minor-cleanups, ELPA Syncer, 2022/12/13
- [nongnu] elpa/flx 2903e5d2a7 084/182: Merge pull request #42 from bbatsov/byte-compile-warning, ELPA Syncer, 2022/12/13
- [nongnu] elpa/flx 9440288782 086/182: Refactor to make prefix match clear., ELPA Syncer, 2022/12/13