emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] master 0a133c7: Move let-when-compile to lisp-mode.el


From: Oleh Krehel
Subject: [Emacs-diffs] master 0a133c7: Move let-when-compile to lisp-mode.el
Date: Wed, 23 Sep 2015 11:51:41 +0000

branch: master
commit 0a133c70f1d2c068e8ad3ed5527f13ea7246fc68
Author: Oleh Krehel <address@hidden>
Commit: Oleh Krehel <address@hidden>

    Move let-when-compile to lisp-mode.el
    
    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 |   13 +++++++++++++
 lisp/subr.el                 |   13 -------------
 2 files changed, 13 insertions(+), 13 deletions(-)

diff --git a/lisp/emacs-lisp/lisp-mode.el b/lisp/emacs-lisp/lisp-mode.el
index 4576f5c..f8b935e 100644
--- a/lisp/emacs-lisp/lisp-mode.el
+++ b/lisp/emacs-lisp/lisp-mode.el
@@ -235,6 +235,19 @@
                              (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"))
diff --git a/lisp/subr.el b/lisp/subr.el
index ce3011d..b1b3638 100644
--- a/lisp/subr.el
+++ b/lisp/subr.el
@@ -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\"



reply via email to

[Prev in Thread] Current Thread [Next in Thread]