[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: How to tame compiler?
From: |
Michael Heerdegen |
Subject: |
Re: How to tame compiler? |
Date: |
Sun, 02 May 2021 07:58:51 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) |
Jean Louis <bugs@gnu.support> writes:
> How do I go to create dynamical bindings? Help me.
Newest Emacs versions have `dlet' to create dynamical bindings. Here is
the definition:
#+begin_src emacs-lisp
(defmacro dlet (binders &rest body)
"Like `let*' but using dynamic scoping."
(declare (indent 1) (debug let))
`(let (_)
,@(mapcar (lambda (binder)
`(defvar ,(if (consp binder) (car binder) binder)))
binders)
(let* ,binders ,@body)))
#+end_src
Use that macro to create dynamical bindings where you really need, and
rely on lexical binding else.
Apart from that, I recommend to take Stefan's suggestions into
consideration, he knows what he is talking about.
Regards,
Michael.