changeset 5579:3e621ba12d36

Don't byte-compile at macroexpansion time, load-time-vale. lisp/ChangeLog addition: 2011-10-08 Aidan Kehoe <kehoea@parhasard.net> * bytecomp.el (byte-compile-initial-macro-environment): In the compiler implementation of load-time-value, don't byte-compile at macroexpansion time, delay that until byte-compilation time, giving, e.g. labels a chance to do its thing.
author Aidan Kehoe <kehoea@parhasard.net>
date Sat, 08 Oct 2011 12:01:20 +0100
parents 4a6f90020a59
children a0e81357194e
files lisp/ChangeLog lisp/bytecomp.el
diffstat 2 files changed, 24 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/ChangeLog	Tue Oct 04 10:59:17 2011 +0100
+++ b/lisp/ChangeLog	Sat Oct 08 12:01:20 2011 +0100
@@ -1,3 +1,11 @@
+2011-10-08  Aidan Kehoe  <kehoea@parhasard.net>
+
+	* bytecomp.el (byte-compile-initial-macro-environment):
+	In the compiler implementation of load-time-value, don't
+	byte-compile at macroexpansion time, delay that until
+	byte-compilation time, giving, e.g. labels a chance to do its
+	thing.
+
 2011-10-04  Aidan Kehoe  <kehoea@parhasard.net>
 
 	* autoload.el (make-autoload):
--- a/lisp/bytecomp.el	Tue Oct 04 10:59:17 2011 +0100
+++ b/lisp/bytecomp.el	Sat Oct 08 12:01:20 2011 +0100
@@ -500,16 +500,22 @@
 	      (if (listp cl-declare-stack) (push (car specs) cl-declare-stack))
 	      (cl-do-proclaim (pop specs) nil))))
     (load-time-value
-     . ,#'(lambda (form &optional read-only)
-            (let* ((gensym (gensym))
-                   (byte-compile-bound-variables
-                    (acons gensym byte-compile-global-bit
-                           byte-compile-bound-variables)))
-              (setq byte-compile-output-preface
-                    (byte-compile-top-level
-                     `(progn (setq ,gensym ,form) ,byte-compile-output-preface)
-                     t 'file))
-              `(symbol-value ',gensym))))
+     . ,(symbol-macrolet ((wrapper '#:load-time-value))
+          (put wrapper 'byte-compile
+               #'(lambda (form)
+                   (let* ((gensym (gensym))
+                          (byte-compile-bound-variables
+                           (acons gensym byte-compile-global-bit
+                                  byte-compile-bound-variables)))
+                     (setq byte-compile-output-preface
+                           (byte-compile-top-level
+                            `(progn
+                              (setq ,gensym (progn ,(second form)))
+                              ,byte-compile-output-preface)
+                            t 'file))
+                     (byte-compile-form `(symbol-value ',gensym) nil))))
+          #'(lambda (form &optional read-only)
+              (list wrapper form))))
     (labels
         . ,#'(lambda (bindings &rest body)
                (let* ((names (mapcar 'car bindings))