emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Nicolas Goaziou <mail@nicolasgoaziou.fr>
To: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: emacs-orgmode@gnu.org
Subject: Re: Improving org-macro.el
Date: Fri, 16 Apr 2021 16:47:49 +0200	[thread overview]
Message-ID: <87y2diffqi.fsf@nicolasgoaziou.fr> (raw)
In-Reply-To: <jwvwnt9he8s.fsf-monnier+emacs@gnu.org> (Stefan Monnier's message of "Sun, 11 Apr 2021 13:17:54 -0400")


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.


> 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

>       #+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.

Nicolas Goaziou

  reply	other threads:[~2021-04-16 14:48 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-11 17:17 Improving org-macro.el Stefan Monnier
2021-04-16 14:47 ` Nicolas Goaziou [this message]
2021-04-16 16:22   ` Stefan Monnier
2021-04-16 22:06   ` Stefan Monnier
2021-04-17  9:48     ` Nicolas Goaziou

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87y2diffqi.fsf@nicolasgoaziou.fr \
    --to=mail@nicolasgoaziou.fr \
    --cc=emacs-orgmode@gnu.org \
    --cc=monnier@iro.umontreal.ca \


* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox


This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).