changeset 5613:a944c124b2d3

Be more careful about what we shadow, #'byte-compile-eval. 2011-12-13 Aidan Kehoe <kehoea@parhasard.net> * bytecomp.el (byte-compile-eval): When evaluating code at compile time, don't put those macros in the macro environment that only make sense when creating byte-compiled output.
author Aidan Kehoe <kehoea@parhasard.net>
date Tue, 13 Dec 2011 20:42:30 +0000
parents 2c20bc575989
children 281bf2b87915
files lisp/ChangeLog lisp/bytecomp.el
diffstat 2 files changed, 14 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/ChangeLog	Tue Dec 13 20:28:32 2011 +0000
+++ b/lisp/ChangeLog	Tue Dec 13 20:42:30 2011 +0000
@@ -5,6 +5,13 @@
 
 2011-12-13  Aidan Kehoe  <kehoea@parhasard.net>
 
+	* bytecomp.el (byte-compile-eval):
+	When evaluating code at compile time, don't put those macros in
+	the macro environment that only make sense when creating
+	byte-compiled output.
+
+2011-12-13  Aidan Kehoe  <kehoea@parhasard.net>
+
 	* bytecomp.el (byte-compile-initial-macro-environment):
 	If lexical let has played with our lambas, give up on constructing
 	the compiled functions at compiled time, that strategy doesn't
--- a/lisp/bytecomp.el	Tue Dec 13 20:28:32 2011 +0000
+++ b/lisp/bytecomp.el	Tue Dec 13 20:42:30 2011 +0000
@@ -455,11 +455,16 @@
 ;;; "If a file being compiled contains a `defmacro' form, the macro is
 ;;; defined temporarily for the rest of the compilation of that file."
 (defun byte-compile-eval (form)
-  (let ((save-macro-environment nil))
+  (let ((save-macro-environment nil)
+	;; These are macros in byte-compile-initial-macro-environment that
+	;; shouldn't be shadowed when calling #'byte-compile-eval, since
+	;; such code is interpreted, not compiled.
+	;; #### Consider giving this a docstring and a top-level value.
+	(byte-compile-no-shadow '(load-time-value labels flet)))
     (unwind-protect
 	(loop
 	  for (sym . def) in byte-compile-macro-environment
-	  do (when (symbolp sym)
+	  do (when (and (symbolp sym) (not (memq sym byte-compile-no-shadow)))
 	       (push
 		(if (fboundp sym)
 		    (cons sym (symbol-function sym))