mirror of
git://git.sv.gnu.org/emacs.git
synced 2025-12-15 10:30:25 -08:00
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).
This commit is contained in:
parent
325200ac1d
commit
0a133c70f1
2 changed files with 13 additions and 13 deletions
|
|
@ -235,6 +235,19 @@
|
||||||
(match-beginning 0)))))
|
(match-beginning 0)))))
|
||||||
(throw 'found t))))))
|
(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
|
(let-when-compile
|
||||||
((lisp-fdefs '("defmacro" "defun"))
|
((lisp-fdefs '("defmacro" "defun"))
|
||||||
(lisp-vdefs '("defvar"))
|
(lisp-vdefs '("defvar"))
|
||||||
|
|
|
||||||
13
lisp/subr.el
13
lisp/subr.el
|
|
@ -1503,19 +1503,6 @@ All symbols are bound before the VALUEFORMs are evalled."
|
||||||
,@(mapcar (lambda (binder) `(setq ,@binder)) binders)
|
,@(mapcar (lambda (binder) `(setq ,@binder)) binders)
|
||||||
,@body))
|
,@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)
|
(defmacro with-wrapper-hook (hook args &rest body)
|
||||||
"Run BODY, using wrapper functions from HOOK with additional ARGS.
|
"Run BODY, using wrapper functions from HOOK with additional ARGS.
|
||||||
HOOK is an abnormal hook. Each hook function in HOOK \"wraps\"
|
HOOK is an abnormal hook. Each hook function in HOOK \"wraps\"
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue