comparison 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
comparison
equal deleted inserted replaced
5629:0d05accafc63 5630:f5315ccbf005
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 (!NILP (environment) &&
1569 !EQ (environment, Vbyte_compile_macro_environment))
1569 { 1570 {
1570 if (NILP (Vbyte_compile_macro_environment)) 1571 if (NILP (Vbyte_compile_macro_environment))
1571 { 1572 {
1572 specbind (Qbyte_compile_macro_environment, environment); 1573 specbind (Qbyte_compile_macro_environment, environment);
1573 } 1574 }
1574 else 1575 else
1575 { 1576 {
1576 specbind (Qbyte_compile_macro_environment, 1577 specbind (Qbyte_compile_macro_environment,
1577 nconc2 (Fcopy_list (environment), 1578 nconc2 (Fcopy_list (environment),
1578 Vbyte_compile_macro_environment)); 1579 Vbyte_compile_macro_environment));
1579 environment = Vbyte_compile_macro_environment;
1580 } 1580 }
1581 } 1581 }
1582
1583 environment = Vbyte_compile_macro_environment;
1582 1584
1583 while (1) 1585 while (1)
1584 { 1586 {
1585 /* Come back here each time we expand a macro call, 1587 /* Come back here each time we expand a macro call,
1586 in case it expands into another macro call. */ 1588 in case it expands into another macro call. */