[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/flx abe1a77c02 081/182: Merge pull request #38 from artagn
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/flx abe1a77c02 081/182: Merge pull request #38 from artagnon/cl-lib |
Date: |
Tue, 13 Dec 2022 03:59:32 -0500 (EST) |
branch: elpa/flx
commit abe1a77c022ad787a8338cdc763f0b1666a2d690
Merge: 569beec178 7424f54816
Author: Le Wang <l26wang@gmail.com>
Commit: Le Wang <l26wang@gmail.com>
Merge pull request #38 from artagnon/cl-lib
Use cl-lib everywhere, not cl
---
flx-ido.el | 15 +++++++--------
flx.el | 43 ++++++++++++++++++++++---------------------
2 files changed, 29 insertions(+), 29 deletions(-)
diff --git a/flx-ido.el b/flx-ido.el
index 1d3de6a34f..f9c69aa3e7 100644
--- a/flx-ido.el
+++ b/flx-ido.el
@@ -8,7 +8,7 @@
;; Created: Sun Apr 21 20:38:36 2013 (+0800)
;; Version: 0.2
;; URL: https://github.com/lewang/flx
-;; Package-Requires: ((flx "0.1"))
+;; Package-Requires: ((flx "0.1") (cl-lib "0.3"))
;; This file is NOT part of GNU Emacs.
@@ -54,7 +54,6 @@
;;; Code:
-(eval-when-compile (require 'cl))
(require 'ido)
(require 'flx)
@@ -97,7 +96,7 @@ item, in which case, the ending items are deleted."
best-match
exact
res)
- (loop for key being the hash-key of flx-ido-narrowed-matches-hash
+ (cl-loop for key being the hash-key of flx-ido-narrowed-matches-hash
do (when (and (>= (length query-key) (length key))
(eq t
(compare-strings query-key 0 (min (length
query-key)
@@ -109,7 +108,7 @@ item, in which case, the ending items are deleted."
(when (= (length key)
(length query-key))
(setq exact t)
- (return))))
+ (cl-return))))
(setq res (cond (exact
(gethash best-match flx-ido-narrowed-matches-hash))
(best-match
@@ -127,7 +126,7 @@ item, in which case, the ending items are deleted."
(let ((decorate-count (min ido-max-prospects
(length things))))
(nconc
- (loop for thing in things
+ (cl-loop for thing in things
for i from 0 below decorate-count
collect (if clear
(flx-propertize thing nil)
@@ -141,7 +140,7 @@ item, in which case, the ending items are deleted."
(defun flx-ido-match-internal (query items)
(if (< (length items) flx-ido-threshhold)
- (let* ((matches (loop for item in items
+ (let* ((matches (cl-loop for item in items
for string = (if (consp item) (car item) item)
for score = (flx-score string query flx-file-cache)
if score
@@ -152,7 +151,7 @@ item, in which case, the ending items are deleted."
(sort matches
(lambda (x y) (> (cadr x) (cadr y)))))))
(let ((regexp (mapconcat 'identity (split-string query "" t) ".*")))
- (loop for item in items
+ (cl-loop for item in items
if (string-match regexp (if (consp item) (car item) item))
collect item
into matches
@@ -168,7 +167,7 @@ item, in which case, the ending items are deleted."
(defun flx-ido-match (query items)
"Better sorting for flx ido matching."
- (destructuring-bind (exact res-items)
+ (cl-destructuring-bind (exact res-items)
(flx-ido-narrowed query items)
(flx-ido-cache query (if exact
res-items
diff --git a/flx.el b/flx.el
index 301e4a2bb4..b3a2f5cc3f 100644
--- a/flx.el
+++ b/flx.el
@@ -7,6 +7,7 @@
;; Description: fuzzy matching with good sorting
;; Created: Wed Apr 17 01:01:41 2013 (+0800)
;; Version: 0.1
+;; Package-Requires: ((cl-lib "0.3"))
;; URL: https://github.com/lewang/flx
;; This file is NOT part of GNU Emacs.
@@ -49,7 +50,7 @@
;;; Code:
-(eval-when-compile (require 'cl))
+(require 'cl-lib)
(defface flx-highlight-face '((t (:inherit font-lock-variable-name-face :bold
t :underline t)))
"Face used by flx for highlighting flx match characters."
@@ -62,7 +63,7 @@
(let* ((res (make-hash-table :test 'eq :size 32))
(str-len (length str))
char)
- (loop for index from (1- str-len) downto 0
+ (cl-loop for index from (1- str-len) downto 0
do (progn
(setq char (downcase (aref str index)))
(push index (gethash char res))))
@@ -102,8 +103,8 @@ from BEG (inclusive) to end (not inclusive).
(or end
(setq end (length vec)))
(while (< beg end)
- (incf (aref vec beg) inc)
- (incf beg))
+ (cl-incf (aref vec beg) inc)
+ (cl-incf beg))
vec)
;; So we store one fixnum per character. Is this too memory inefficient?
@@ -118,9 +119,9 @@ See documentation for logic."
(penalty-lead ?.)
(groups-alist (list (list -1 0))))
;; ++++ final char bonus
- (incf (aref scores str-last-index) 1)
+ (cl-incf (aref scores str-last-index) 1)
;; Establish baseline mapping
- (loop for char across str
+ (cl-loop for char across str
for index from 0
with last-char = nil
with group-word-count = 0
@@ -131,13 +132,13 @@ See documentation for logic."
;; gets penalized compared to "foo/ab".
(if (zerop group-word-count) nil last-char)))
(when (flx-boundary-p effective-last-char char)
- (setcdr (cdar groups-alist) (cons index (cddar
groups-alist))))
+ (setcdr (cdar groups-alist) (cons index (cl-cddar
groups-alist))))
(when (and (not (flx-word-p last-char))
(flx-word-p char))
- (incf group-word-count)))
+ (cl-incf group-word-count)))
;; ++++ -45 penalize extension
(when (eq last-char penalty-lead)
- (incf (aref scores index) -45))
+ (cl-incf (aref scores index) -45))
(when (eq group-separator char )
(setcar (cdar groups-alist) group-word-count)
(setq group-word-count 0)
@@ -151,7 +152,7 @@ See documentation for logic."
(unless (zerop separator-count)
(flx-inc-vec scores (* -2 group-count)))
;; score each group further
- (loop for group in groups-alist
+ (cl-loop for group in groups-alist
for index from separator-count downto 0
with last-group-limit = nil
with basepath-found = nil
@@ -179,17 +180,17 @@ See documentation for logic."
-3
(+ -5 (1- index)))))
(flx-inc-vec scores num (1+ group-start) last-group-limit))
- (loop for word in (cddr group)
+ (cl-loop for word in (cddr group)
for word-index from (1- words-length) downto 0
with last-word = (or last-group-limit
str-len)
do (progn
- (incf (aref scores word)
+ (cl-incf (aref scores word)
;; ++++ beg word bonus AND
85)
- (loop for index from word below last-word
+ (cl-loop for index from word below last-word
for char-i from 0
- do (incf (aref scores index)
+ do (cl-incf (aref scores index)
(-
;; ++++ word order penalty
(* -3 word-index)
@@ -209,9 +210,9 @@ See documentation for logic."
if VAL is nil, return entire list."
(if val
- (loop for sub on sorted-list
+ (cl-loop for sub on sorted-list
do (when (> (car sub) val)
- (return sub)))
+ (cl-return sub)))
sorted-list))
(defun flx-get-matches (hash query &optional greater-than q-index)
@@ -289,15 +290,15 @@ e.g. (\"aab\" \"ab\") returns
0))
(contiguous-count 0)
last-match)
- (loop for index in match-positions
+ (cl-loop for index in match-positions
do (progn
(if (and last-match
(= (1+ last-match) index))
- (incf contiguous-count)
+ (cl-incf contiguous-count)
(setq contiguous-count 0))
- (incf score (aref heatmap index))
+ (cl-incf score (aref heatmap index))
(when (> contiguous-count 0)
- (incf score (+ 45 (* 15 (min contiguous-count
4)))))
+ (cl-incf score (+ 45 (* 15 (min contiguous-count
4)))))
(setq last-match index)))
(if (or (null best-score)
(> score (car best-score)))
@@ -317,7 +318,7 @@ SCORE of nil means to clear the properties."
(substring-no-properties obj))))
(unless (null score)
- (loop for char in (cdr score)
+ (cl-loop for char in (cdr score)
do (progn
(when (and last-char
(not (= (1+ last-char) char)))
- [nongnu] elpa/flx 48e10bf54f 177/182: Update to latest version of GPLv3 boilerplate, (continued)
- [nongnu] elpa/flx 48e10bf54f 177/182: Update to latest version of GPLv3 boilerplate, ELPA Syncer, 2022/12/13
- [nongnu] elpa/flx 8ee8a877ab 028/182: boost entire match score, ELPA Syncer, 2022/12/13
- [nongnu] elpa/flx 78dc69a666 023/182: fix query with CAPITAL letters, ELPA Syncer, 2022/12/13
- [nongnu] elpa/flx 095f2e70f9 040/182: remove text property of selected item, ELPA Syncer, 2022/12/13
- [nongnu] elpa/flx 50ff90fa08 017/182: add ido cache of narrowed list optimization, ELPA Syncer, 2022/12/13
- [nongnu] elpa/flx 3208d8131e 043/182: make undecorate select item more thorough, ELPA Syncer, 2022/12/13
- [nongnu] elpa/flx fb1ded43df 044/182: cache cons cell lists too, ELPA Syncer, 2022/12/13
- [nongnu] elpa/flx d21ac098df 050/182: add option `flx-ido-use-faces', ELPA Syncer, 2022/12/13
- [nongnu] elpa/flx f9bd16221b 063/182: update large collection guidelines, ELPA Syncer, 2022/12/13
- [nongnu] elpa/flx 27bc47899a 075/182: Merge pull request #37 from artagnon/make, ELPA Syncer, 2022/12/13
- [nongnu] elpa/flx abe1a77c02 081/182: Merge pull request #38 from artagnon/cl-lib,
ELPA Syncer <=
- [nongnu] elpa/flx 9200e27309 083/182: use "flex" filtering when collection too large, ELPA Syncer, 2022/12/13
- [nongnu] elpa/flx c85273a6e8 009/182: fix helm demo typo, ELPA Syncer, 2022/12/13
- [nongnu] elpa/flx 7110df04e2 005/182: update tests, ELPA Syncer, 2022/12/13
- [nongnu] elpa/flx fabca711e9 013/182: fix typo, ELPA Syncer, 2022/12/13
- [nongnu] elpa/flx dc739574ad 011/182: add helm demo without flx, ELPA Syncer, 2022/12/13
- [nongnu] elpa/flx 955772f489 029/182: optimize full-match boost, ELPA Syncer, 2022/12/13
- [nongnu] elpa/flx 0519734c5b 030/182: consider runs of capitals to be same word, ELPA Syncer, 2022/12/13
- [nongnu] elpa/flx e80bc0dea4 018/182: more ido optimizations, refactor out flx-propertize, ELPA Syncer, 2022/12/13
- [nongnu] elpa/flx a31814e5ef 031/182: update README to say alpha, ELPA Syncer, 2022/12/13
- [nongnu] elpa/flx 5ab18c3101 024/182: fix over manipulation of strings, ELPA Syncer, 2022/12/13