]> code.delx.au - gnu-emacs/commitdiff
Move let-when-compile to lisp-mode.el
authorOleh Krehel <ohwoeowho@gmail.com>
Wed, 23 Sep 2015 11:50:15 +0000 (13:50 +0200)
committerOleh Krehel <ohwoeowho@gmail.com>
Wed, 23 Sep 2015 11:50:15 +0000 (13:50 +0200)
This fixes the bootstrapping problem of `let-when-compile' using
`cl-progv' while being in subr.el (i.e. before cl stuff was loaded).

lisp/emacs-lisp/lisp-mode.el
lisp/subr.el

index 4576f5cd6badb822678dfba7249fb405702790fb..f8b935eb90b2817ba28b4a4d8bf0fadb06faca6d 100644 (file)
                              (match-beginning 0)))))
          (throw 'found t))))))
 
+(defmacro let-when-compile (bindings &rest body)
+  "Like `let', but allow for compile time optimization.
+Use BINDINGS as in regular `let', but in BODY each usage should
+be wrapped in `eval-when-compile'.
+This will generate compile-time constants from BINDINGS."
+  (declare (indent 1) (debug let))
+  (cl-progv (mapcar #'car bindings)
+      (mapcar (lambda (x) (eval (cadr x))) bindings)
+    (macroexpand-all
+     (macroexp-progn
+      body)
+     macroexpand-all-environment)))
+
 (let-when-compile
     ((lisp-fdefs '("defmacro" "defun"))
      (lisp-vdefs '("defvar"))
index ce3011d4e46a6b1ed0f5f32fa0bda07ccbdefabb..b1b363864f9aae034cd392ba54804325e3cdc628 100644 (file)
@@ -1503,19 +1503,6 @@ All symbols are bound before the VALUEFORMs are evalled."
      ,@(mapcar (lambda (binder) `(setq ,@binder)) binders)
      ,@body))
 
-(defmacro let-when-compile (bindings &rest body)
-  "Like `let', but allow for compile time optimization.
-Use BINDINGS as in regular `let', but in BODY each usage should
-be wrapped in `eval-when-compile'.
-This will generate compile-time constants from BINDINGS."
-  (declare (indent 1) (debug let))
-  (cl-progv (mapcar #'car bindings)
-      (mapcar (lambda (x) (eval (cadr x))) bindings)
-    (macroexpand-all
-     (macroexp-progn
-      body)
-     macroexpand-all-environment)))
-
 (defmacro with-wrapper-hook (hook args &rest body)
   "Run BODY, using wrapper functions from HOOK with additional ARGS.
 HOOK is an abnormal hook.  Each hook function in HOOK \"wraps\"