summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Mendler <mail@daniel-mendler.de>2024-03-03 14:00:10 +0100
committerDaniel Mendler <mail@daniel-mendler.de>2024-03-03 14:00:45 +0100
commite7b81ae428918e7ee5bdb8ec9c6333c8d4ca3b78 (patch)
treecda0d53b5310df8db14d7c0839b5941e019e512f
parent7545dc7c07d1465e9661209ca5930ae3f1a870a3 (diff)
Add orderless-prefix matching style
This matching style is useful as a return value of a style dispatcher like orderless-affix-dispatch. It matches literals as a prefix and triggers the prefix filter optimization, see `orderless--anchored-quoted-regexp'.
-rw-r--r--orderless.el4
1 files changed, 4 insertions, 0 deletions
diff --git a/orderless.el b/orderless.el
index 0186241..4c96137 100644
--- a/orderless.el
+++ b/orderless.el
@@ -221,6 +221,10 @@ is determined by the values of `completion-ignore-case',
"Match COMPONENT as a literal string."
`(literal ,component))
+(defun orderless-prefix (component)
+ "Match COMPONENT as a literal prefix string."
+ `(seq bol (literal ,component)))
+
(defun orderless--separated-by (sep rxs &optional before after)
"Return a regexp to match the rx-regexps RXS with SEP in between.
If BEFORE is specified, add it to the beginning of the rx