[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: &allow-other-keys + &rest body in cl-defmacro (was: Permanently fix
From: |
Ihor Radchenko |
Subject: |
Re: &allow-other-keys + &rest body in cl-defmacro (was: Permanently fix org versioning breakage during builds?) |
Date: |
Mon, 25 Dec 2023 12:21:31 +0000 |
João Távora <joaotavora@gmail.com> writes:
>> Now I feel a bit like RMS when he complained about CL-lib introducing
>> alien concepts to Elisp :)
>
> It's not Cl-lib's fault that the Org developers made a mistake and didn't
> understand how the Common Lisp tool they selected works.
I do not blame cl-lib. Mostly grumbling on unexpected concept that is
hard to grasp even after reading the manual (maybe, the manual could be
improved).
> Even in Elisp a zillion macros are correctly written in this form:
>
> (defmacro with-foo (options-when-fooing &rest body)
>
> It's exactly the same, only you need to do the destructuring yourself.
> cl-defmacro simplifies this for free with
>
> (cl-defmacro with-foo ((&key option1 option2) &body body)
It would be nice if this approach were described in the manual.
Now, there is just description of destructuring, but it is very generic.
>> What about non-breaking change like the attached?
>
> You should be checking for `keywordp` instead, because &allow-other-keys.
The only reason I used &allow-other-keys is that I couldn't use &rest
without specifying &allow-other-keys.
(I did not know about ((&key ...) &rest body) trick when writing this macro.)
--
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>
- Re: Permanently fix org versioning breakage during builds?, (continued)
- Re: Permanently fix org versioning breakage during builds?, João Távora, 2023/12/24
- Re: Permanently fix org versioning breakage during builds?, Ihor Radchenko, 2023/12/24
- Re: Permanently fix org versioning breakage during builds?, João Távora, 2023/12/24
- Re: Permanently fix org versioning breakage during builds?, Ihor Radchenko, 2023/12/24
- Re: Permanently fix org versioning breakage during builds?, João Távora, 2023/12/24
- &allow-other-keys + &rest body in cl-defmacro (was: Permanently fix org versioning breakage during builds?), Ihor Radchenko, 2023/12/25
- Re: &allow-other-keys + &rest body in cl-defmacro (was: Permanently fix org versioning breakage during builds?), João Távora, 2023/12/25
- Re: &allow-other-keys + &rest body in cl-defmacro (was: Permanently fix org versioning breakage during builds?),
Ihor Radchenko <=
- Re: &allow-other-keys + &rest body in cl-defmacro (was: Permanently fix org versioning breakage during builds?), Ihor Radchenko, 2023/12/25
- Re: Permanently fix org versioning breakage during builds?, Ihor Radchenko, 2023/12/25
- Re: Permanently fix org versioning breakage during builds?, João Távora, 2023/12/25
- Re: Permanently fix org versioning breakage during builds?, Ihor Radchenko, 2023/12/25
- Re: Permanently fix org versioning breakage during builds?, T.V Raman, 2023/12/24
- Re: Permanently fix org versioning breakage during builds?, Eli Zaretskii, 2023/12/24
- Re: Permanently fix org versioning breakage during builds?, Ihor Radchenko, 2023/12/24
- Re: Permanently fix org versioning breakage during builds?, João Távora, 2023/12/24
- Re: Permanently fix org versioning breakage during builds?, Ihor Radchenko, 2023/12/24
- Re: Permanently fix org versioning breakage during builds?, Ihor Radchenko, 2023/12/24