[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/orderless 9c1b276fe4 193/204: Optimize orderless-try-co
From: |
ELPA Syncer |
Subject: |
[elpa] externals/orderless 9c1b276fe4 193/204: Optimize orderless-try-completion |
Date: |
Tue, 11 Jan 2022 12:58:30 -0500 (EST) |
branch: externals/orderless
commit 9c1b276fe43a3de177470f84ddf315ae5f2221e6
Author: Daniel Mendler <mail@daniel-mendler.de>
Commit: Daniel Mendler <mail@daniel-mendler.de>
Optimize orderless-try-completion
---
orderless.el | 29 ++++++++++++++++++-----------
1 file changed, 18 insertions(+), 11 deletions(-)
diff --git a/orderless.el b/orderless.el
index a458f329d5..9250756688 100644
--- a/orderless.el
+++ b/orderless.el
@@ -458,17 +458,24 @@ match, it completes to that match. If there are no
matches, it
returns nil. In any other case it \"completes\" STRING to
itself, without moving POINT.
This function is part of the `orderless' completion style."
- (let ((all (orderless-filter string table pred)))
- (cond
- ((null all) nil)
- ((null (cdr all))
- (if (equal string (car all))
- t ; unique exact match
- (let ((full (concat
- (car (orderless--prefix+pattern string table pred))
- (car all))))
- (cons full (length full)))))
- (t (cons string point)))))
+ (catch 'orderless--many
+ (let (one)
+ ;; Abuse all-completions/orderless-filter as a fast search loop.
+ ;; Should be more or less allocation-free since our "predicate"
+ ;; always returns nil.
+ (orderless-filter string table
+ (lambda (str)
+ (when (or (not pred) (funcall pred str))
+ (when one
+ (throw 'orderless--many (cons string point)))
+ (setq one str))
+ nil))
+ (when one
+ (if (equal string one)
+ t ;; unique exact match
+ (setq one (concat (car (orderless--prefix+pattern string table pred))
+ one))
+ (cons one (length one)))))))
;;;###autoload
(add-to-list 'completion-styles-alist
- [elpa] externals/orderless c023ee1cbe 150/204: Add option to skip-highlighting as requested by @clemera, (continued)
- [elpa] externals/orderless c023ee1cbe 150/204: Add option to skip-highlighting as requested by @clemera, ELPA Syncer, 2022/01/11
- [elpa] externals/orderless 1ed0c4aabb 153/204: Fix typo, ELPA Syncer, 2022/01/11
- [elpa] externals/orderless 0ebc884693 154/204: Update manual to not recommend icomplete anymore, ELPA Syncer, 2022/01/11
- [elpa] externals/orderless 9d5b95f402 157/204: Merge pull request #40 from minad/master, ELPA Syncer, 2022/01/11
- [elpa] externals/orderless 150155ce3c 160/204: Add literal matching to default styles and document (fix #42), ELPA Syncer, 2022/01/11
- [elpa] externals/orderless 44935d8962 166/204: Fix bug when all matching styles return nil, ELPA Syncer, 2022/01/11
- [elpa] externals/orderless e85084e733 179/204: Merge pull request #58 from minad/add-face-text-property, ELPA Syncer, 2022/01/11
- [elpa] externals/orderless 3f76b7d1a1 185/204: Delete duplicate regexps (fix #73), ELPA Syncer, 2022/01/11
- [elpa] externals/orderless cc15f27107 188/204: orderless-escapable-split-on-space: Fix escaping mistake, ELPA Syncer, 2022/01/11
- [elpa] externals/orderless d97a91f6e1 172/204: Merge pull request #51 from minad/disable-initialism, ELPA Syncer, 2022/01/11
- [elpa] externals/orderless 9c1b276fe4 193/204: Optimize orderless-try-completion,
ELPA Syncer <=
- [elpa] externals/orderless 7385bcf3c1 203/204: Assign copyright to FSF, ELPA Syncer, 2022/01/11
- [elpa] externals/orderless cce7072dc3 148/204: Mention completion-category-defaults in the documentation, ELPA Syncer, 2022/01/11
- [elpa] externals/orderless b46dbb1045 016/204: Merge branch 'master' of https://github.com/oantolin/orderless, ELPA Syncer, 2022/01/11
- [elpa] externals/orderless ac12bc4d54 020/204: Unify calls to save-match-data, ELPA Syncer, 2022/01/11
- [elpa] externals/orderless 31fbb254c4 036/204: Update badly outdated commentary, ELPA Syncer, 2022/01/11
- [elpa] externals/orderless d2b5d71e75 027/204: Better match face defaults (kindly contributed by Protesilaos), ELPA Syncer, 2022/01/11
- [elpa] externals/orderless ff6f57c7c8 046/204: Implement component matching styles, ELPA Syncer, 2022/01/11
- [elpa] externals/orderless 36bf6ee6df 048/204: Documentation improvements, ELPA Syncer, 2022/01/11
- [elpa] externals/orderless 42eb6bfc6e 053/204: Now on MELPA!, ELPA Syncer, 2022/01/11
- [elpa] externals/orderless 1f7339fdf0 049/204: Minor improvements to README, ELPA Syncer, 2022/01/11