Stefan Monnier writes: >> (progv (mapcar #'car bindings) >> (mapcar (lambda (x) (eval (cadr x))) bindings) >> (funcall >> `(lambda () >> (macroexpand-all >> '(progn >> ,@body)))))) > > Hmm? Why this funcall+backquote+lambda business? > [ Oh, and be careful to pass macroexpand-all-environment as second arg > to macroexpand-all. ] No reason, just copied it from `progv' and didn't simplify. Here's the final version: (defmacro let-when-compile (bindings &rest body) "Like `let', but allows for compile time optimization. \n(fn BINDINGS BODY)" (declare (indent 1) (debug let)) (cl-progv (mapcar #'car bindings) (mapcar (lambda (x) (eval (cadr x))) bindings) (macroexpand-all `(progn ,@body) macroexpand-all-environment))) >> The code in lisp-mode.el works fine, but there's still one thing on >> which I'm not sure: what should happen if an `eval-when-compile' wrapper >> is omitted? > > Same as what happens in your earlier let-opt when the `opt' is > omitted. So I guess it's fine. The byte compiler will issue a warning about an unbound variable if `eval-when-compile' is omitted by mistake. I was thinking maybe something clever could be done, like automatically leaving a let binding to prevent an error. Should I install the patch? Oleh