Mercurial > emacs
changeset 100293:bb1d2d686d04
(rx-submatch): Pass : to rx-form (bug#1518).
author | Stefan Monnier <monnier@iro.umontreal.ca> |
---|---|
date | Tue, 09 Dec 2008 21:17:09 +0000 |
parents | 816fe1a75404 |
children | 21d77f0ff75e |
files | lisp/ChangeLog lisp/emacs-lisp/rx.el |
diffstat | 2 files changed, 11 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/lisp/ChangeLog Tue Dec 09 20:36:23 2008 +0000 +++ b/lisp/ChangeLog Tue Dec 09 21:17:09 2008 +0000 @@ -1,3 +1,7 @@ +2008-12-09 Stefan Monnier <monnier@iro.umontreal.ca> + + * emacs-lisp/rx.el (rx-submatch): Pass : to rx-form. + 2008-12-09 Glenn Morris <rgm@gnu.org> * Makefile.in (ELCFILES): Update.
--- a/lisp/emacs-lisp/rx.el Tue Dec 09 20:36:23 2008 +0000 +++ b/lisp/emacs-lisp/rx.el Tue Dec 09 21:17:09 2008 +0000 @@ -666,7 +666,13 @@ (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)