diff src/eval.c @ 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 5f4f92a31875
children 289cf21be887
line wrap: on
line diff
--- 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,