comparison 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
comparison
equal deleted inserted replaced
5657:2a870a7b86bd 5658:289cf21be887
1563 /* This function can GC */ 1563 /* This function can GC */
1564 /* With cleanups from Hallvard Furuseth. */ 1564 /* With cleanups from Hallvard Furuseth. */
1565 REGISTER Lisp_Object expander, sym, def, tem; 1565 REGISTER Lisp_Object expander, sym, def, tem;
1566 int speccount = specpdl_depth (); 1566 int speccount = specpdl_depth ();
1567 1567
1568 if (!NILP (environment) && 1568 if (!EQ (environment, Vbyte_compile_macro_environment))
1569 !EQ (environment, Vbyte_compile_macro_environment)) 1569 {
1570 { 1570 specbind (Qbyte_compile_macro_environment, environment);
1571 if (NILP (Vbyte_compile_macro_environment)) 1571 }
1572 {
1573 specbind (Qbyte_compile_macro_environment, environment);
1574 }
1575 else
1576 {
1577 specbind (Qbyte_compile_macro_environment,
1578 nconc2 (Fcopy_list (environment),
1579 Vbyte_compile_macro_environment));
1580 }
1581 }
1582
1583 environment = Vbyte_compile_macro_environment;
1584 1572
1585 while (1) 1573 while (1)
1586 { 1574 {
1587 /* Come back here each time we expand a macro call, 1575 /* Come back here each time we expand a macro call,
1588 in case it expands into another macro call. */ 1576 in case it expands into another macro call. */
7659 7647
7660 DEFVAR_LISP ("byte-compile-macro-environment", &Vbyte_compile_macro_environment /* 7648 DEFVAR_LISP ("byte-compile-macro-environment", &Vbyte_compile_macro_environment /*
7661 Alist of macros defined in the file being compiled. 7649 Alist of macros defined in the file being compiled.
7662 Each element looks like (MACRONAME . DEFINITION). It is 7650 Each element looks like (MACRONAME . DEFINITION). It is
7663 \(MACRONAME . nil) when a macro is redefined as a function. 7651 \(MACRONAME . nil) when a macro is redefined as a function.
7652
7653 You should normally access this using the &environment argument to
7654 #'macrolet, #'defmacro* and friends, and not directly; see the documentation
7655 of those macros.
7664 */); 7656 */);
7665 Vbyte_compile_macro_environment = Qnil; 7657 Vbyte_compile_macro_environment = Qnil;
7666 7658
7667 staticpro (&Vcatch_everything_tag); 7659 staticpro (&Vcatch_everything_tag);
7668 Vcatch_everything_tag = make_opaque (OPAQUE_CLEAR, 0); 7660 Vcatch_everything_tag = make_opaque (OPAQUE_CLEAR, 0);