diff options
author | Stefan Monnier <monnier@iro.umontreal.ca> | 2008-12-09 21:17:09 +0000 |
---|---|---|
committer | Stefan Monnier <monnier@iro.umontreal.ca> | 2008-12-09 21:17:09 +0000 |
commit | e9e9c7b89182a6b253ef130011b49a2f1612eee6 (patch) | |
tree | 99fc9358423a977f2b4f07bb90f6270dd0bd3064 | |
parent | 7c54c0a06e3c08636e350f4f0d6a893ed4cef47a (diff) | |
download | emacs-e9e9c7b89182a6b253ef130011b49a2f1612eee6.tar.gz |
(rx-submatch): Pass : to rx-form (bug#1518).
-rw-r--r-- | lisp/ChangeLog | 4 | ||||
-rw-r--r-- | lisp/emacs-lisp/rx.el | 8 |
2 files changed, 11 insertions, 1 deletions
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 <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. 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) |