From e9e9c7b89182a6b253ef130011b49a2f1612eee6 Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Tue, 9 Dec 2008 21:17:09 +0000 Subject: [PATCH] (rx-submatch): Pass : to rx-form (bug#1518). --- lisp/ChangeLog | 4 ++++ lisp/emacs-lisp/rx.el | 8 +++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 5af9ed44e04..6dd1cd01bb1 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,7 @@ +2008-12-09 Stefan Monnier + + * emacs-lisp/rx.el (rx-submatch): Pass : to rx-form. + 2008-12-09 Glenn Morris * Makefile.in (ELCFILES): Update. diff --git a/lisp/emacs-lisp/rx.el b/lisp/emacs-lisp/rx.el index c5e94874793..7f3793f05ac 100644 --- a/lisp/emacs-lisp/rx.el +++ b/lisp/emacs-lisp/rx.el @@ -666,7 +666,13 @@ FORM is either `(repeat N FORM1)' or `(repeat N M FORM1)'." (defun rx-submatch (form) "Parse and produce code from FORM, which is `(submatch ...)'." - (concat "\\(" (mapconcat #'rx-form (cdr form) nil) "\\)")) + (concat "\\(" + (if (= 2 (length form)) + ;; Only one sub-form. + (rx-form (cadr form)) + ;; Several sub-forms implicitly concatenated. + (mapconcat (lambda (re) (rx-form re ':)) (cdr form) nil)) + "\\)")) (defun rx-backref (form) -- 2.39.2