[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/orderless b600f88db0 144/204: Add orderless-define-comp
From: |
ELPA Syncer |
Subject: |
[elpa] externals/orderless b600f88db0 144/204: Add orderless-define-completion-style macro, a new fix for #31 |
Date: |
Tue, 11 Jan 2022 12:58:25 -0500 (EST) |
branch: externals/orderless
commit b600f88db066f8dc44c517711efa399b3630ec3d
Author: Omar Antolín <omar.antolin@gmail.com>
Commit: Omar Antolín <omar.antolin@gmail.com>
Add orderless-define-completion-style macro, a new fix for #31
---
orderless.el | 36 ++++++++++++++++++++++++++++++++++++
1 file changed, 36 insertions(+)
diff --git a/orderless.el b/orderless.el
index d4fe98a1e1..b4ec2fc838 100644
--- a/orderless.el
+++ b/orderless.el
@@ -514,6 +514,42 @@ This function is part of the `orderless' completion style."
orderless-try-completion orderless-all-completions
"Completion of multiple components, in any order."))
+(defmacro orderless-define-completion-style
+ (name docstrings &rest configuration)
+ "Define an orderless completion style with given CONFIGURATION.
+The CONFIGURATION should be a list of bindings that you could use
+with `let' to configure orderless. You can include bindings for
+`orderless-matching-styles' and `orderless-style-dispatchers',
+for example.
+
+The completion style consists of two functions that this macro
+defines for you, NAME-try-completion and NAME-all-completions.
+This macro registers those in `completion-styles-alist' as
+forming the completion style NAME.
+
+The DOCSTRINGS argument should be a list of between 0 to 3
+strings. The strings present are used as the documentation
+string for the completion style, NAME-try-completion, and
+NAME-all-completions, respectively."
+ (declare (indent defun))
+ (let* ((fn-name (lambda (string) (intern (concat (symbol-name name)
string))))
+ (try-completion (funcall fn-name "-try-completion"))
+ (all-completions (funcall fn-name "-all-completions")))
+ `(progn
+ (defun ,try-completion (string table pred point)
+ ,(cadr docstrings)
+ (let ,configuration
+ (orderless-all-completions string table pred point)))
+
+ (defun ,all-completions (string table pred point)
+ ,(caddr docstrings)
+ (let ,configuration
+ (orderless-all-completions string table pred point)))
+
+ (add-to-list 'completion-styles-alist
+ '(,name ,try-completion ,all-completions
+ ,(car docstrings))))))
+
;;; Ivy integration
(defvar ivy-regex)
- [elpa] externals/orderless f8efbdae4d 087/204: Document style dispatches in the README, (continued)
- [elpa] externals/orderless f8efbdae4d 087/204: Document style dispatches in the README, ELPA Syncer, 2022/01/11
- [elpa] externals/orderless e16fc5ddb1 099/204: Ido has progressive completion too!, ELPA Syncer, 2022/01/11
- [elpa] externals/orderless dc1a31b5fc 098/204: Merge remote-tracking branch 'github/master', ELPA Syncer, 2022/01/11
- [elpa] externals/orderless 306fb267f5 100/204: Mark orderless-temporarily-change-separator obsolete (#15), ELPA Syncer, 2022/01/11
- [elpa] externals/orderless 09f4c74280 105/204: Update dispatchers documentation, add transient vars, ELPA Syncer, 2022/01/11
- [elpa] externals/orderless bc9e48216e 120/204: Add option for "smart case" matching, ELPA Syncer, 2022/01/11
- [elpa] externals/orderless 1f1e0380e2 122/204: Test for match before highlighting it, ELPA Syncer, 2022/01/11
- [elpa] externals/orderless 6b94b9abf8 124/204: Merge pull request #21 from wyuenho/patch-1, ELPA Syncer, 2022/01/11
- [elpa] externals/orderless 0826fd4eb4 130/204: Merge pull request #27 from vifon/master, ELPA Syncer, 2022/01/11
- [elpa] externals/orderless fc420e3d07 134/204: Minor readme tweak, ELPA Syncer, 2022/01/11
- [elpa] externals/orderless b600f88db0 144/204: Add orderless-define-completion-style macro, a new fix for #31,
ELPA Syncer <=
- [elpa] externals/orderless 94d52640d4 145/204: Change docstring interface for orderless-define-completion-style, ELPA Syncer, 2022/01/11
- [elpa] externals/orderless da876320b3 146/204: Remove all orderless-transient-* variables (fix #34), ELPA Syncer, 2022/01/11
- [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