[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [External] : Re: Why is defun not executed during load-file?
From: |
Marcin Borkowski |
Subject: |
Re: [External] : Re: Why is defun not executed during load-file? |
Date: |
Mon, 31 May 2021 22:09:04 +0200 |
User-agent: |
mu4e 1.1.0; emacs 28.0.50 |
On 2021-05-31, at 21:47, Stefan Monnier via Users list for the GNU Emacs text
editor <help-gnu-emacs@gnu.org> wrote:
>> Hm ... interesting. Yeah, maybe we should start do that more?
>
> Not really: it's better to avoid macros when you can.
> But it's better to use macros than to use `eval`.
>
>> What kind of things or problems could or should you solve
>> with macros?
>
> Whenever you find yourself forced to use `eval` ?
Or when you lack some syntactical construct you could find useful, like
anaphoric-if. Or if what you need is closer to a "special form" than to
a function. A typical case is when you need a construct which will be
able to evaluate something or not, depending on the circumstances. Or
when you need a construct which will evaluate some form(s) /after/ doing
something (remember that when a function gets its arguments, they are
all evaluated before even the first form of a function is evaluated!).
Here (shameless plug!) is an example of something you couldn't achieve
with functions alone (unless you wanted to wrap some code in `(lambda ()
...)', which would be rather ugly):
http://mbork.pl/2016-04-24_The_conditional-save-excursion_macro
Hth,
--
Marcin Borkowski
http://mbork.pl
- Re: Why is defun not executed during load-file?, (continued)
Re: Why is defun not executed during load-file?, Drew Adams, 2021/05/30
- Re: Why is defun not executed during load-file?, Emanuel Berg, 2021/05/30
- RE: [External] : Re: Why is defun not executed during load-file?, Drew Adams, 2021/05/30
- Re: [External] : Re: Why is defun not executed during load-file?, Emanuel Berg, 2021/05/30
- RE: [External] : Re: Why is defun not executed during load-file?, Drew Adams, 2021/05/31
- Re: [External] : Re: Why is defun not executed during load-file?, Emanuel Berg, 2021/05/31
- Re: [External] : Re: Why is defun not executed during load-file?, Stefan Monnier, 2021/05/31
- Re: [External] : Re: Why is defun not executed during load-file?,
Marcin Borkowski <=
- Example use of macro to minimize and generalize the code, Jean Louis, 2021/05/31
- Re: Example use of macro to minimize and generalize the code, Michael Heerdegen, 2021/05/31
- Re: Example use of macro to minimize and generalize the code, Jean Louis, 2021/05/31
- Re: Example use of macro to minimize and generalize the code, Michael Heerdegen, 2021/05/31
- Re: Example use of macro to minimize and generalize the code, Jean Louis, 2021/05/31
- Re: Example use of macro to minimize and generalize the code, Michael Heerdegen, 2021/05/31
- Re: Example use of macro to minimize and generalize the code, Jean Louis, 2021/05/31
Example use of macro to minimize and generalize the code (2), Jean Louis, 2021/05/31
Re: [External] : Re: Why is defun not executed during load-file?, Michael Heerdegen, 2021/05/31
RE: [External] : Re: Why is defun not executed during load-file?, Drew Adams, 2021/05/31