summaryrefslogtreecommitdiff
path: root/lisp/emacs-lisp/rx.el
diff options
context:
space:
mode:
authorMattias EngdegÄrd <mattiase@acm.org>2022-07-31 12:54:53 +0200
committerMattias EngdegÄrd <mattiase@acm.org>2022-07-31 13:01:26 +0200
commitac237334c7672377721e4d27e8ecd6b09d453568 (patch)
tree837b036508f3e0a68b69d27db96c5ea06082d521 /lisp/emacs-lisp/rx.el
parentf48493577d9dcfddecda5d8b40e156c5c063d9c6 (diff)
downloademacs-ac237334c7672377721e4d27e8ecd6b09d453568.tar.gz
emacs-ac237334c7672377721e4d27e8ecd6b09d453568.tar.bz2
emacs-ac237334c7672377721e4d27e8ecd6b09d453568.zip
Reduce internal rx autoloads
* lisp/emacs-lisp/rx.el (rx--to-expr, rx--pcase-transform): Don't autoload. (rx--pcase-macroexpander): Extract body into... (rx--pcase-expand): ...a separate function, which is autoloaded.
Diffstat (limited to 'lisp/emacs-lisp/rx.el')
-rw-r--r--lisp/emacs-lisp/rx.el10
1 files changed, 6 insertions, 4 deletions
diff --git a/lisp/emacs-lisp/rx.el b/lisp/emacs-lisp/rx.el
index a2cf23f2711..ec51146484a 100644
--- a/lisp/emacs-lisp/rx.el
+++ b/lisp/emacs-lisp/rx.el
@@ -1150,8 +1150,6 @@ For extending the `rx' notation in FORM, use `rx-define' or `rx-let-eval'."
(rx--atomic-regexp item))))
(apply #'concat exprs)))
-;; Autoloaded because it's referred to by form in loaddefs.el.
-;;;###autoload
(defun rx--to-expr (form)
"Translate the rx-expression FORM to a Lisp expression yielding a regexp."
(let* ((rx--delayed-evaluation t)
@@ -1407,8 +1405,6 @@ For more details, see Info node `(elisp) Extending Rx'.
;; becomes a problem, we can handle those forms in the ordinary parser,
;; using a dynamic variable for activating the augmented forms.
-;; Autoloaded because it's referred to by form in loaddefs.el.
-;;;###autoload
(defun rx--pcase-transform (rx)
"Transform RX, an rx-expression augmented with `let' and named `backref',
into a plain rx-expression, collecting names into `rx--pcase-vars'."
@@ -1455,6 +1451,12 @@ following constructs:
REF can be a number, as usual, or a name
introduced by a previous (let REF ...)
construct."
+ (rx--pcase-expand regexps))
+
+;; Autoloaded because it's referred to by the pcase rx macro above,
+;; whose body ends up in loaddefs.el.
+;;;###autoload
+(defun rx--pcase-expand (regexps)
(let* ((rx--pcase-vars nil)
(regexp (rx--to-expr (rx--pcase-transform (cons 'seq regexps)))))
`(and (pred stringp)