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 /lisp/emacs-lisp | |
parent | 7c54c0a06e3c08636e350f4f0d6a893ed4cef47a (diff) | |
download | emacs-e9e9c7b89182a6b253ef130011b49a2f1612eee6.tar.gz emacs-e9e9c7b89182a6b253ef130011b49a2f1612eee6.tar.bz2 emacs-e9e9c7b89182a6b253ef130011b49a2f1612eee6.zip |
(rx-submatch): Pass : to rx-form (bug#1518).
Diffstat (limited to 'lisp/emacs-lisp')
-rw-r--r-- | lisp/emacs-lisp/rx.el | 8 |
1 files changed, 7 insertions, 1 deletions
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) |