From: Stefan Monnier Date: Tue, 9 Dec 2008 21:17:09 +0000 (+0000) Subject: (rx-submatch): Pass : to rx-form (bug#1518). X-Git-Tag: emacs-pretest-23.0.90~1209 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=e9e9c7b89182a6b253ef130011b49a2f1612eee6;p=emacs.git (rx-submatch): Pass : to rx-form (bug#1518). --- 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)