[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/orderless 1ad6bd254b 021/204: Only copy and highlight o
From: |
ELPA Syncer |
Subject: |
[elpa] externals/orderless 1ad6bd254b 021/204: Only copy and highlight once the candidate is known to match |
Date: |
Tue, 11 Jan 2022 12:58:14 -0500 (EST) |
branch: externals/orderless
commit 1ad6bd254bc9227b7161de598ca26a0e020dbe1e
Author: Omar Antolín <omar.antolin@gmail.com>
Commit: Omar Antolín <omar.antolin@gmail.com>
Only copy and highlight once the candidate is known to match
Benchmarking suggests this is often close to twice as fast.
---
orderless.el | 30 +++++++++++++++++-------------
1 file changed, 17 insertions(+), 13 deletions(-)
diff --git a/orderless.el b/orderless.el
index 08a2f41cd3..c7b6e1c833 100644
--- a/orderless.el
+++ b/orderless.el
@@ -45,14 +45,14 @@
;;; Code:
-(defun orderless-highlight-match (regexp string)
- (when (string-match regexp string)
- (font-lock-prepend-text-property
- (match-beginning 0)
- (match-end 0)
- 'face 'completions-common-part
- string)
- t))
+(defun orderless--highlight-match (regexp string)
+ ;; only call this when the match has already been checked!
+ (string-match regexp string)
+ (font-lock-prepend-text-property
+ (match-beginning 0)
+ (match-end 0)
+ 'face 'completions-common-part
+ string))
(defun orderless-all-completions (string table pred _point)
(save-match-data
@@ -66,11 +66,15 @@
(progn
(setq all
(cl-loop for original in all
- for candidate = (copy-sequence original)
- when (cl-loop for regexp in regexps
- always (orderless-highlight-match
- regexp candidate))
- collect candidate))
+ when
+ (cl-loop for regexp in regexps
+ always (string-match-p regexp original))
+ collect ; it's a match, copy and highlight
+ (cl-loop with candidate = (copy-sequence original)
+ for regexp in regexps do
+ (orderless--highlight-match
+ regexp candidate)
+ finally (return candidate))))
(when all (nconc all (length prefix))))
(invalid-regexp nil)))))
- [elpa] externals/orderless 7a547b5722 093/204: Drew says "progressive completion", (continued)
- [elpa] externals/orderless 7a547b5722 093/204: Drew says "progressive completion", ELPA Syncer, 2022/01/11
- [elpa] externals/orderless 99e90bf139 103/204: Declare orderless-old-component-separator obsolete too, ELPA Syncer, 2022/01/11
- [elpa] externals/orderless 42bca066b9 108/204: Split dispatchers into their own variable, ELPA Syncer, 2022/01/11
- [elpa] externals/orderless 81248a8dbf 109/204: Merge branch 'dispatcher', ELPA Syncer, 2022/01/11
- [elpa] externals/orderless 0efa87672d 011/204: Fix bug on no matches, ELPA Syncer, 2022/01/11
- [elpa] externals/orderless acc2645cf3 030/204: Even better match faces (kindly contributed by Protesilaos), ELPA Syncer, 2022/01/11
- [elpa] externals/orderless 6ada0ad21c 035/204: Add docstrings to functions, ELPA Syncer, 2022/01/11
- [elpa] externals/orderless a371c26c69 003/204: Stronger wording for warning, ELPA Syncer, 2022/01/11
- [elpa] externals/orderless d576dc9fac 028/204: Add reminder that match faces only are used if orderless "wins", ELPA Syncer, 2022/01/11
- [elpa] externals/orderless 6aabc83f02 022/204: Remove warning and stuff about SPC, ELPA Syncer, 2022/01/11
- [elpa] externals/orderless 1ad6bd254b 021/204: Only copy and highlight once the candidate is known to match,
ELPA Syncer <=
- [elpa] externals/orderless f2af44bf2e 057/204: Mention Icicles's progressive matching, ELPA Syncer, 2022/01/11
- [elpa] externals/orderless 1631eb1733 073/204: Fix autoload for ivy, ELPA Syncer, 2022/01/11
- [elpa] externals/orderless 862eed345c 075/204: Add more orderless initialism styles, ELPA Syncer, 2022/01/11
- [elpa] externals/orderless e3644defcd 088/204: Add orderless-pattern-compiler variable for maximum flexibility, ELPA Syncer, 2022/01/11
- [elpa] externals/orderless 436ef98b16 089/204: Add optional argument for dispatches: total number of components, ELPA Syncer, 2022/01/11
- [elpa] externals/orderless ed37c22902 097/204: Prefer descriptive argument over "mystery t's", ELPA Syncer, 2022/01/11
- [elpa] externals/orderless 9cebf2fc8c 106/204: Escape parenthesis in first column of docstrings, ELPA Syncer, 2022/01/11
- [elpa] externals/orderless 93f4bccea1 112/204: Go back to split-string until empty components issue is resolved, ELPA Syncer, 2022/01/11
- [elpa] externals/orderless 2d1f68b914 114/204: Fix tiny bug in customization type, ELPA Syncer, 2022/01/11
- [elpa] externals/orderless 5c2f44d901 115/204: Allow component separator to be a function, ELPA Syncer, 2022/01/11