Function: eval-when-compile

eval-when-compile is a macro defined in byte-run.el.gz.

Signature

(eval-when-compile &rest BODY)

Documentation

Like progn, but evaluates the body at compile time if you're compiling.

Thus, the result of the body appears to the compiler as a quoted constant. In interpreted code, this is entirely equivalent to progn, except that the value of the expression may be (but is not necessarily) computed at load time if eager macro expansion is enabled.

View in manual

Source Code

;; Defined in /usr/src/emacs/lisp/emacs-lisp/byte-run.el.gz
;; interface to evaluating things at compile time and/or load time
;; these macro must come after any uses of them in this file, as their
;; definition in the file overrides the magic definitions on the
;; byte-compile-macro-environment.

(defmacro eval-when-compile (&rest body)
  "Like `progn', but evaluates the body at compile time if you're compiling.
Thus, the result of the body appears to the compiler as a quoted
constant.  In interpreted code, this is entirely equivalent to
`progn', except that the value of the expression may be (but is
not necessarily) computed at load time if eager macro expansion
is enabled."
  (declare (debug (&rest def-form)) (indent 0))
  (list 'quote (eval (cons 'progn body) lexical-binding)))