diff src/eval.c @ 5658:289cf21be887

Don't augment ENVIRONMENT when that's not indicated, #'macroexpand. This reflects better understanding on my part of the &environment macro keyword, and I've expanded the Lisp manual and docstrings to reflect that. lisp/ChangeLog addition: 2012-05-06 Aidan Kehoe <kehoea@parhasard.net> * cl-macs.el (block): Comment on why we can't use &environment here. * cl-macs.el (defmacro*): Document &environment in more detail. * cl-macs.el (macrolet): Use &environment, instead of referencing byte-compile-macro-environment directly. * cl-macs.el (symbol-macrolet): Ditto. * cl-macs.el (lexical-let): Ditto. * cl-macs.el (labels): Ditto. man/ChangeLog addition: 2012-05-06 Aidan Kehoe <kehoea@parhasard.net> * lispref/macros.texi (Expansion): Cross-reference to documentation of #'cl-prettyexpand, #'defmacro* when talking about #'macroexpand. tests/ChangeLog addition: 2012-05-06 Aidan Kehoe <kehoea@parhasard.net> * automated/lisp-tests.el: Use &environment appropriately in #'macrolet, instead of relying on #'macroexpand to guess what we mean.
author Aidan Kehoe <kehoea@parhasard.net>
date Sun, 06 May 2012 15:29:59 +0100
parents f5315ccbf005
children 3192994c49ca
line wrap: on
line diff
--- a/src/eval.c	Sun May 06 05:22:19 2012 +0100
+++ b/src/eval.c	Sun May 06 15:29:59 2012 +0100
@@ -1565,22 +1565,10 @@
   REGISTER Lisp_Object expander, sym, def, tem;
   int speccount = specpdl_depth ();
 
-  if (!NILP (environment) &&
-      !EQ (environment, Vbyte_compile_macro_environment))
-    {
-      if (NILP (Vbyte_compile_macro_environment))
-        {
-          specbind (Qbyte_compile_macro_environment, environment);
-        }
-      else
-        {
-          specbind (Qbyte_compile_macro_environment,
-                    nconc2 (Fcopy_list (environment),
-                            Vbyte_compile_macro_environment));
-        }
-    }
-
-  environment = Vbyte_compile_macro_environment;
+  if (!EQ (environment, Vbyte_compile_macro_environment))
+    {
+      specbind (Qbyte_compile_macro_environment, environment);
+    }
 
   while (1)
     {
@@ -7661,6 +7649,10 @@
 Alist of macros defined in the file being compiled.
 Each element looks like (MACRONAME . DEFINITION).  It is
 \(MACRONAME . nil) when a macro is redefined as a function.
+
+You should normally access this using the &environment argument to
+#'macrolet, #'defmacro* and friends, and not directly; see the documentation
+of those macros.
 */);
   Vbyte_compile_macro_environment = Qnil;