feat(lib): add eval-when-compile! macro
Unlike eval-when-compile, the body of this macro's calls will only be evaluated while byte-compiling.
This commit is contained in:
parent
0100b08402
commit
4009509db5
1 changed files with 8 additions and 0 deletions
|
@ -286,6 +286,14 @@ See `eval-if!' for details on this macro's purpose."
|
||||||
(when (eval cond)
|
(when (eval cond)
|
||||||
(macroexp-progn body)))
|
(macroexp-progn body)))
|
||||||
|
|
||||||
|
(defmacro eval-when-compile! (&rest body)
|
||||||
|
"Evaluate BODY *only* during byte-compilation.
|
||||||
|
|
||||||
|
Unlike `eval-when-compile', which is equivalent to `progn' in interpreted code,
|
||||||
|
this macro's BODY will only be evaluated during byte-compilation."
|
||||||
|
(declare (indent 0))
|
||||||
|
(when (bound-and-true-p byte-compile-current-file)
|
||||||
|
(ignore (eval (macroexp-progn body) t))))
|
||||||
|
|
||||||
;;; Closure factories
|
;;; Closure factories
|
||||||
(defmacro lambda! (arglist &rest body)
|
(defmacro lambda! (arglist &rest body)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue