Skip to content

Commit

Permalink
Document the new rx format for matching styles
Browse files Browse the repository at this point in the history
  • Loading branch information
oantolin committed Feb 15, 2024
1 parent 2c952fd commit 61aed3e
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 18 deletions.
9 changes: 4 additions & 5 deletions README.org
Original file line number Diff line number Diff line change
Expand Up @@ -119,9 +119,10 @@ Protesilaos Stavrou's lovely [[https://gitlab.com/protesilaos/modus-themes][modu
** Component matching styles

Each component of a pattern can match in any of several matching
styles. A matching style is simply a function from strings to strings
that maps a component to a regexp to match against, so it is easy to
define new matching styles. The predefined ones are:
styles. A matching style is simply a function from strings to regexps,
so it is easy to define new matching styles. The regexp returned by a
matching style can be either a string or an s-expression in =rx= syntax.
The predefined matching styles are:

- orderless-regexp :: the component is treated as a regexp that must
match somewhere in the candidate.
Expand All @@ -131,8 +132,6 @@ define new matching styles. The predefined ones are:
- orderless-literal :: the component is treated as a literal string
that must occur in the candidate.

This is just =regexp-quote=.

- *orderless-without-literal* :: the component is a treated as a literal
string that must *not* occur in the candidate.

Expand Down
12 changes: 6 additions & 6 deletions orderless.el
Original file line number Diff line number Diff line change
Expand Up @@ -114,12 +114,12 @@ or a function of a single string argument."
"List of component matching styles.
If this variable is nil, regexp matching is assumed.
A matching style is simply a function from strings to strings
that takes a component to a regexp to match against. If the
resulting regexp has no capturing groups, the entire match is
highlighted, otherwise just the captured groups are. Several are
provided with this package: try customizing this variable to see
a list of them."
A matching style is simply a function from strings to regexps.
The returned regexps can be either strings or s-expressions in
`rx' syntax. If the resulting regexp has no capturing groups,
the entire match is highlighted, otherwise just the captured
groups are. Several are provided with this package: try
customizing this variable to see a list of them."
:type 'hook
:options (list #'orderless-regexp
#'orderless-literal
Expand Down
13 changes: 6 additions & 7 deletions orderless.texi
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ Related packages
* Ivy and Helm::
* Prescient::
* Restricting to current matches in Icicles, Ido and Ivy: Restricting to current matches in Icicles Ido and Ivy.
* Restricting to current matches in Icicles, Ido and Ivy: Restricting to current matches in Icicles Ido and Ivy.
@end detailmenu
@end menu
Expand Down Expand Up @@ -151,9 +151,10 @@ Bug reports are highly welcome and appreciated!
@section Component matching styles

Each component of a pattern can match in any of several matching
styles. A matching style is simply a function from strings to strings
that maps a component to a regexp to match against, so it is easy to
define new matching styles. The predefined ones are:
styles. A matching style is simply a function from strings to regexps,
so it is easy to define new matching styles. The regexp returned by a
matching style can be either a string or an s-expression in @samp{rx} syntax.
The predefined matching styles are:

@table @asis
@item orderless-regexp
Expand All @@ -166,8 +167,6 @@ If the component is not a valid regexp, it is ignored.
the component is treated as a literal string
that must occur in the candidate.

This is just @samp{regexp-quote}.

@item @strong{orderless-without-literal}
the component is a treated as a literal
string that must @strong{not} occur in the candidate.
Expand Down Expand Up @@ -576,4 +575,4 @@ Ivy has @samp{ivy-restrict-to-matches}, bound to @samp{S-SPC}, so you can get th
effect of out of order matching without using @samp{ivy--regex-ignore-order}.
@end itemize
@bye
@bye

0 comments on commit 61aed3e

Please sign in to comment.