summaryrefslogtreecommitdiff
path: root/lisp/emacs-lisp/cl-macs.el
diff options
context:
space:
mode:
authorStefan Monnier <monnier@iro.umontreal.ca>2007-08-16 04:24:57 +0000
committerStefan Monnier <monnier@iro.umontreal.ca>2007-08-16 04:24:57 +0000
commit4d78a860b9ee2b830d6b9fc67e55c83d516df0c4 (patch)
tree55829fdfb225e8056aeeaa926c78e910fed30c25 /lisp/emacs-lisp/cl-macs.el
parent596047b3e7e70e0c71ef1d206fa951b45b32e05d (diff)
downloademacs-4d78a860b9ee2b830d6b9fc67e55c83d516df0c4.tar.gz
(cl-transform-lambda): Preserve the match-data.
Diffstat (limited to 'lisp/emacs-lisp/cl-macs.el')
-rw-r--r--lisp/emacs-lisp/cl-macs.el22
1 files changed, 13 insertions, 9 deletions
diff --git a/lisp/emacs-lisp/cl-macs.el b/lisp/emacs-lisp/cl-macs.el
index 5a79a6424e0..e4a84e44e64 100644
--- a/lisp/emacs-lisp/cl-macs.el
+++ b/lisp/emacs-lisp/cl-macs.el
@@ -266,15 +266,19 @@ its argument list allows full Common Lisp conventions."
(nconc (nreverse simple-args)
(list '&rest (car (pop bind-lets))))
(nconc (let ((hdr (nreverse header)))
- (require 'help-fns)
- (cons (help-add-fundoc-usage
- (if (stringp (car hdr)) (pop hdr))
- ;; orig-args can contain &cl-defs (an internal CL
- ;; thingy that I do not understand), so remove it.
- (let ((x (memq '&cl-defs orig-args)))
- (if (null x) orig-args
- (delq (car x) (remq (cadr x) orig-args)))))
- hdr))
+ ;; Macro expansion can take place in the middle of
+ ;; apparently harmless computation, so it should not
+ ;; touch the match-data.
+ (save-match-data
+ (require 'help-fns)
+ (cons (help-add-fundoc-usage
+ (if (stringp (car hdr)) (pop hdr))
+ ;; orig-args can contain &cl-defs (an internal
+ ;; CL thingy I don't understand), so remove it.
+ (let ((x (memq '&cl-defs orig-args)))
+ (if (null x) orig-args
+ (delq (car x) (remq (cadr x) orig-args)))))
+ hdr)))
(list (nconc (list 'let* bind-lets)
(nreverse bind-forms) body)))))))