~ chicken-core (chicken-5) 8434c5c578260f2ccc4d4ecba70d6d8f53f89d91


commit 8434c5c578260f2ccc4d4ecba70d6d8f53f89d91
Author:     felix <felix@call-with-current-continuation.org>
AuthorDate: Tue Feb 22 09:02:24 2011 +0100
Commit:     felix <felix@call-with-current-continuation.org>
CommitDate: Tue Feb 22 09:02:24 2011 +0100

    keep macro environment extension in eval/meta

diff --git a/eval.scm b/eval.scm
index c3d28c6d..d08f3426 100644
--- a/eval.scm
+++ b/eval.scm
@@ -232,15 +232,23 @@
 	(##sys#eval-decorator p ll h cntr) )
 
       (define (eval/meta form)
-	(parameterize ((##sys#current-module #f)
-		       (##sys#macro-environment (##sys#meta-macro-environment)))
-	  ;;XXX definitions extending the macro-env will be lost after
-	  ;;    this body exits, or not?
-	  ((##sys#compile-to-closure
-	    form
-	    '() 
-	    (##sys#current-meta-environment))
-	   '() ) ))
+	(let ((oldcm (##sys#current-module))
+	      (oldme (##sys#macro-environment))
+	      (mme (##sys#meta-macro-environment)))
+	  (dynamic-wind
+	      (lambda () 
+		(##sys#current-module #f)
+		(##sys#macro-environment mme))
+	      (lambda ()
+		((##sys#compile-to-closure
+		  form
+		  '() 
+		  (##sys#current-meta-environment))
+		 '() ) )
+	      (lambda ()
+		(##sys#current-module oldcm)
+		(##sys#meta-macro-environment (##sys#macro-environment))
+		(##sys#macro-environment oldme)))))
 
       (define (eval/elab form)
 	((##sys#compile-to-closure
Trap