emacs-orgmode
[Top][All Lists]
Advanced

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

Re: Improving org-macro.el


From: Nicolas Goaziou
Subject: Re: Improving org-macro.el
Date: Fri, 16 Apr 2021 16:47:49 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux)

Hello,

Stefan Monnier <monnier@iro.umontreal.ca> writes:

> In any case, the code struck me as quite inefficient since it
> reparses the macro definition every time the macro is called.

Indeed.

> I came up with the tentative patch below.

Thank you.

> It seems to work on Org's own manual, but other than that I haven't gone
> out of my way to test it.

There were a few problems reported by the test suite that I tried to
address. I also updated `org-lint', which didn't handle macro
definitions as functions.

> - It also changes the behavior when $N appears elsewhere than an
>   "expression context".  E.g.:
>
>       #+macro: <name> (eval (let (($1 foo)) (bar)))

This is not a valid macro definition anyway since placeholders are
strings.

>       #+macro: <name> (eval (fun-with "code $1"))

I don't think this was valid previously either, for the same reason.

> I don't think it requires changes to the manual because the semantics
> described in the manual is sufficiently incomplete that both the old and
> the new semantics satisfy it.

One noticeable effect is that empty or missing placeholders in macro
call are now nil, instead of the empty string. This broke our internal
macros (e.g., {{{n}}} and {{{property}}}) so I updated them.

I mentioned it in the ORG-NEWS file, and applied your changes. We'll see
how it goes.

Regards,
-- 
Nicolas Goaziou



reply via email to

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