summaryrefslogtreecommitdiff
path: root/lisp/emacs-lisp
diff options
context:
space:
mode:
authorMattias EngdegÄrd <mattiase@acm.org>2022-06-29 11:01:16 +0200
committerMattias EngdegÄrd <mattiase@acm.org>2022-06-29 17:27:30 +0200
commit3447e79f2493580864962db69859bda1afd4643b (patch)
treef891e69e4f69058c7078de1d88e47615f0531218 /lisp/emacs-lisp
parent3bd232ab39d1e479bc4654539bfb15a7ad86c643 (diff)
downloademacs-3447e79f2493580864962db69859bda1afd4643b.tar.gz
emacs-3447e79f2493580864962db69859bda1afd4643b.tar.bz2
emacs-3447e79f2493580864962db69859bda1afd4643b.zip
* lisp/emacs-lisp/rx.el: Indent some rx constructs correctly.
This includes group-n, submatch-n, =, >=, ** and repeat, whose first 1 or 2 arguments are special.
Diffstat (limited to 'lisp/emacs-lisp')
-rw-r--r--lisp/emacs-lisp/rx.el8
1 files changed, 8 insertions, 0 deletions
diff --git a/lisp/emacs-lisp/rx.el b/lisp/emacs-lisp/rx.el
index aa2486b47ec..07ede57d393 100644
--- a/lisp/emacs-lisp/rx.el
+++ b/lisp/emacs-lisp/rx.el
@@ -1110,6 +1110,14 @@ can expand to any number of values."
(append rx--builtin-forms rx--builtin-symbols)
"List of built-in rx names. These cannot be redefined by the user.")
+;; Declare Lisp indentation rules for constructs that take 1 or 2
+;; parameters before a body of RX forms.
+(dolist (sym '( group-n submatch-n = >=))
+ (put sym 'lisp-indent-function 1))
+(dolist (sym '( ** repeat))
+ (put sym 'lisp-indent-function 2))
+
+
(defun rx--translate (item)
"Translate the rx-expression ITEM. Return (REGEXP . PRECEDENCE)."
(cond