emacs-devel
[Top][All Lists]
Advanced

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

Re: Use the new let-opt macro in place of pcase-let in lisp-mode.el


From: Stefan Monnier
Subject: Re: Use the new let-opt macro in place of pcase-let in lisp-mode.el
Date: Mon, 18 May 2015 21:11:44 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux)

>> IOW, define a let-when-compile macro which uses progv to setup the
>> bindings and then calls `macroexpand-all' on the body.  The body's
>> `eval-when-compile' can then use those vars just fine.

> I wrote this:

> (defmacro let-when-compile (bindings &rest body)
>   "Like `let', but allows for compile time optimization.
> \n(fn BINDINGS BODY)"
>   (declare (indent 1) (debug let))
>   `(progv ',(mapcar #'car bindings)
>        ',(mapcar (lambda (x) (eval (cadr x))) bindings)
>      ,@body))

That's not what I suggest.  The `progv' should be done at
macroexpansion-time (otherwise, you're better off using `let').


        Stefan



reply via email to

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