summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Mendler <mail@daniel-mendler.de>2024-02-17 13:47:08 +0100
committerDaniel Mendler <mail@daniel-mendler.de>2024-02-17 13:47:08 +0100
commit9e810f43f0152148f34ab5c84ab311da6bfc8762 (patch)
tree4ccb652224d8f152eb86930f96375081529977a0
parent45d5d457b215aeacdb3471f527947d37b20e1c02 (diff)
Simplify orderless--compile-component
-rw-r--r--orderless.el28
1 files changed, 13 insertions, 15 deletions
diff --git a/orderless.el b/orderless.el
index 98e4080..395f1f2 100644
--- a/orderless.el
+++ b/orderless.el
@@ -383,21 +383,19 @@ DEFAULT as the list of styles."
(defun orderless--compile-component (component idx total styles dispatchers)
"Compile COMPONENT at IDX of TOTAL components with STYLES and DISPATCHERS."
- (pcase-let ((`(,newsty . ,newcomp) (orderless--dispatch dispatchers styles component idx total)))
- (when (functionp newsty)
- (setq newsty (list newsty)))
- (cl-loop
- with pred = nil
- for style in newsty
- for res = (condition-case nil
- (funcall style newcomp)
- (wrong-number-of-arguments
- (when-let ((res (orderless--compile-component newcomp idx total styles dispatchers)))
- (funcall style (car res) (cdr res)))))
- if (functionp res) do (cl-callf orderless--predicate-and pred res)
- else if res collect (if (stringp res) `(regexp ,res) res) into regexps
- finally return
- (and (or pred regexps) (cons pred (and regexps (rx-to-string `(or ,@(delete-dups regexps)))))))))
+ (cl-loop
+ with pred = nil
+ with (newsty . newcomp) = (orderless--dispatch dispatchers styles component idx total)
+ for style in (if (functionp newsty) (list newsty) newsty)
+ for res = (condition-case nil
+ (funcall style newcomp)
+ (wrong-number-of-arguments
+ (when-let ((res (orderless--compile-component newcomp idx total styles dispatchers)))
+ (funcall style (car res) (cdr res)))))
+ if (functionp res) do (cl-callf orderless--predicate-and pred res)
+ else if res collect (if (stringp res) `(regexp ,res) res) into regexps
+ finally return
+ (and (or pred regexps) (cons pred (and regexps (rx-to-string `(or ,@(delete-dups regexps))))))))
(defun orderless-compile (pattern &optional styles dispatchers)
"Build regexps to match the components of PATTERN.