summaryrefslogtreecommitdiff
path: root/lisp/emacs-lisp
diff options
context:
space:
mode:
Diffstat (limited to 'lisp/emacs-lisp')
-rw-r--r--lisp/emacs-lisp/rx.el2
1 files changed, 2 insertions, 0 deletions
diff --git a/lisp/emacs-lisp/rx.el b/lisp/emacs-lisp/rx.el
index 8ef78fd69e6..2130e3e1aea 100644
--- a/lisp/emacs-lisp/rx.el
+++ b/lisp/emacs-lisp/rx.el
@@ -725,6 +725,8 @@ FORM is either `(repeat N FORM1)' or `(repeat N M FORMS...)'."
(defun rx-submatch-n (form)
"Parse and produce code from FORM, which is `(submatch-n N ...)'."
(let ((n (nth 1 form)))
+ (unless (and (integerp n) (> n 0))
+ (error "rx `submatch-n' argument must be positive"))
(concat "\\(?" (number-to-string n) ":"
(if (= 3 (length form))
;; Only one sub-form.