[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/orderless d97a91f6e1 172/204: Merge pull request #51 fr
From: |
ELPA Syncer |
Subject: |
[elpa] externals/orderless d97a91f6e1 172/204: Merge pull request #51 from minad/disable-initialism |
Date: |
Tue, 11 Jan 2022 12:58:28 -0500 (EST) |
branch: externals/orderless
commit d97a91f6e12ace638e65bdccefd14d1e638a2dae
Merge: 0205fb5b0e 8d187bd31e
Author: Omar AntolĂn Camarena <omar.antolin@gmail.com>
Commit: GitHub <noreply@github.com>
Merge pull request #51 from minad/disable-initialism
Only enable regexp and literal matching styles by default
---
README.org | 36 +++++++++++++++++++++++++++++++-----
orderless.el | 4 ++--
orderless.texi | 39 ++++++++++++++++++++++++++++++++++-----
3 files changed, 67 insertions(+), 12 deletions(-)
diff --git a/README.org b/README.org
index fb55289e9b..a7aff1e399 100644
--- a/README.org
+++ b/README.org
@@ -20,7 +20,7 @@ pattern into space-separated components, and matches
candidates that
match all of the components in any order. Each component can match in
any one of several ways: literally, as a regexp, as an initialism, in
the flex style, or as multiple word prefixes. By default, regexp and
-initialism matches are enabled.
+literal matches are enabled.
A completion style is a back-end for completion and is used from a
front-end that provides a completion UI. Any completion style can be
@@ -150,8 +150,8 @@ define new matching styles. The predefined ones are:
This maps =abc= to =a.*b.*c=.
The variable =orderless-matching-styles= can be set to a list of the
-desired matching styles to use. By default it enables the literal,
-regexp and initialism styles.
+desired matching styles to use. By default it enables the literal and
+regexp styles.
*** Style dispatchers
@@ -192,8 +192,11 @@ regexp and initialism styles.
(if (= index 0) 'orderless-initialism))
(defun without-if-bang (pattern _index _total)
- (when (string-prefix-p "!" pattern)
- `(orderless-without-literal . ,(substring pattern 1))))
+ (cond
+ ((equal "!" pattern)
+ '(orderless-literal . ""))
+ ((string-prefix-p "!" pattern)
+ `(orderless-without-literal . ,(substring pattern 1)))))
(setq orderless-matching-styles '(orderless-regexp)
orderless-style-dispatchers '(first-initialism
@@ -222,6 +225,29 @@ If you are implementing a command for which you know you
want a
different separator for the components, bind
=orderless-component-separator= in a =let= form.
+** Defining custom orderless styles
+
+Orderless allows the definition of custom completion styles using the
+~orderless-define-completion-style~ macro. Any Orderless configuration
+variable can be adjusted locally for the new style, e.g.,
+~orderless-matching-styles~.
+
+By default Orderless only enables the regexp and literal matching
+styles. In the following example an ~orderless+initialism~ style is
+defined, which additionally enables initialism matching. This completion
+style can then used when matching candidates of the symbol or command
+completion category.
+
+#+begin_src emacs-lisp
+ (orderless-define-completion-style orderless+initialism
+ (orderless-matching-styles '(orderless-initialism
+ orderless-literal
+ orderless-regexp)))
+ (setq completion-category-overrides
+ '((command (styles orderless+initialism))
+ (symbol (styles orderless+initialism))))
+#+end_src
+
** Faces for component matches
The portions of a candidate matching each component get highlighted in
diff --git a/orderless.el b/orderless.el
index d21bebd573..c67e68574f 100644
--- a/orderless.el
+++ b/orderless.el
@@ -48,7 +48,7 @@
;; from strings to strings that map a component to a regexp to match
;; against. The variable `orderless-matching-styles' lists the
;; matching styles to be used for components, by default it allows
-;; literal, regexp and initialism matching.
+;; literal and regexp matching.
;;; Code:
@@ -114,7 +114,7 @@ value means highlighting is skipped."
:type '(choice boolean function))
(defcustom orderless-matching-styles
- '(orderless-literal orderless-regexp orderless-initialism)
+ '(orderless-literal orderless-regexp)
"List of component matching styles.
If this variable is nil, regexp matching is assumed.
diff --git a/orderless.texi b/orderless.texi
index eb3dc23731..c26060e6a2 100644
--- a/orderless.texi
+++ b/orderless.texi
@@ -36,6 +36,7 @@ Customization
* Component matching styles::
* Component separator regexp::
+* Defining custom orderless styles::
* Faces for component matches::
* Pattern compiler::
* Interactively changing the configuration::
@@ -67,7 +68,7 @@ pattern into space-separated components, and matches
candidates that
match all of the components in any order. Each component can match in
any one of several ways: literally, as a regexp, as an initialism, in
the flex style, or as multiple word prefixes. By default, regexp and
-initialism matches are enabled.
+literal matches are enabled.
A completion style is a back-end for completion and is used from a
front-end that provides a completion UI@. Any completion style can be
@@ -112,6 +113,7 @@ Bug reports are highly welcome and appreciated!
@menu
* Component matching styles::
* Component separator regexp::
+* Defining custom orderless styles::
* Faces for component matches::
* Pattern compiler::
* Interactively changing the configuration::
@@ -189,8 +191,8 @@ This maps @samp{abc} to @samp{a.*b.*c}.
@end table
The variable @samp{orderless-matching-styles} can be set to a list of the
-desired matching styles to use. By default it enables the literal,
-regexp and initialism styles.
+desired matching styles to use. By default it enables the literal and
+regexp styles.
@menu
* Style dispatchers::
@@ -242,8 +244,11 @@ You can achieve this with the following configuration:
(if (= index 0) 'orderless-initialism))
(defun without-if-bang (pattern _index _total)
- (when (string-prefix-p "!" pattern)
- `(orderless-without-literal . ,(substring pattern 1))))
+ (cond
+ ((equal "!" pattern)
+ '(orderless-literal . ""))
+ ((string-prefix-p "!" pattern)
+ `(orderless-without-literal . ,(substring pattern 1)))))
(setq orderless-matching-styles '(orderless-regexp)
orderless-style-dispatchers '(first-initialism
@@ -273,6 +278,30 @@ If you are implementing a command for which you know you
want a
different separator for the components, bind
@samp{orderless-component-separator} in a @samp{let} form.
+@node Defining custom orderless styles
+@section Defining custom orderless styles
+
+Orderless allows the definition of custom completion styles using the
+@code{orderless-define-completion-style} macro. Any Orderless configuration
+variable can be adjusted locally for the new style, e.g.,
+@code{orderless-matching-styles}.
+
+By default Orderless only enables the regexp and literal matching
+styles. In the following example an @code{orderless+initialism} style is
+defined, which additionally enables initialism matching. This completion
+style can then used when matching candidates of the symbol or command
+completion category.
+
+@lisp
+(orderless-define-completion-style orderless+initialism
+ (orderless-matching-styles '(orderless-initialism
+ orderless-literal
+ orderless-regexp)))
+(setq completion-category-overrides
+ '((command (styles orderless+initialism))
+ (symbol (styles orderless+initialism))))
+@end lisp
+
@node Faces for component matches
@section Faces for component matches
- [elpa] externals/orderless da876320b3 146/204: Remove all orderless-transient-* variables (fix #34), (continued)
- [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
- [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 <=
- [elpa] externals/orderless 9c1b276fe4 193/204: Optimize orderless-try-completion, ELPA Syncer, 2022/01/11
- [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