changeset 5630:f5315ccbf005

Cons less, be more careful about always using the environment, #'macroexpand 2011-12-30 Aidan Kehoe <kehoea@parhasard.net> * eval.c (Fmacroexpand): Don't cons if ENVIRONMENT is the same object as byte-compile-macro-environment. Always look up symbol- and other macros in the (possibly modified) byte-compile-macro-environment, not the supplied ENVIRONMENT. byte-compile-macro-environment reflects ENVIRONMENT, so that's OK and preferred.
author Aidan Kehoe <kehoea@parhasard.net>
date Fri, 30 Dec 2011 12:43:52 +0000
parents 0d05accafc63
children 5e256f495401
files src/ChangeLog src/eval.c
diffstat 2 files changed, 14 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/ChangeLog	Wed Dec 28 11:30:47 2011 -0700
+++ b/src/ChangeLog	Fri Dec 30 12:43:52 2011 +0000
@@ -1,3 +1,13 @@
+2011-12-30  Aidan Kehoe  <kehoea@parhasard.net>
+
+	* eval.c (Fmacroexpand):
+	Don't cons if ENVIRONMENT is the same object as
+	byte-compile-macro-environment.
+	Always look up symbol- and other macros in the (possibly modified)
+	byte-compile-macro-environment, not the supplied ENVIRONMENT.
+	byte-compile-macro-environment reflects ENVIRONMENT, so that's OK
+	and preferred.
+
 2011-12-28  Jerry James  <james@xemacs.org>
 
 	* lisp-disunion.h (make_fixnum): avoid losing bits off the left end
--- a/src/eval.c	Wed Dec 28 11:30:47 2011 -0700
+++ b/src/eval.c	Fri Dec 30 12:43:52 2011 +0000
@@ -1565,7 +1565,8 @@
   REGISTER Lisp_Object expander, sym, def, tem;
   int speccount = specpdl_depth ();
 
-  if (!NILP (environment))
+  if (!NILP (environment) &&
+      !EQ (environment, Vbyte_compile_macro_environment))
     {
       if (NILP (Vbyte_compile_macro_environment))
         {
@@ -1576,10 +1577,11 @@
           specbind (Qbyte_compile_macro_environment,
                     nconc2 (Fcopy_list (environment),
                             Vbyte_compile_macro_environment));
-          environment = Vbyte_compile_macro_environment;
         }
     }
 
+  environment = Vbyte_compile_macro_environment;
+
   while (1)
     {
       /* Come back here each time we expand a macro call,