From: Nicolas Goaziou <mail@nicolasgoaziou.fr>
To: orgmode <emacs-orgmode@gnu.org>
Subject: Re: [RFC] [PATCH] Automatically quote the arguments to an eval macro
Date: Thu, 05 Nov 2015 09:40:32 +0100 [thread overview]
Message-ID: <874mh0q1of.fsf@nicolasgoaziou.fr> (raw)
In-Reply-To: <874mh1x2eu.fsf@gmail.com> (Aaron Ecay's message of "Wed, 04 Nov 2015 14:30:33 +0000")
Hello,
Aaron Ecay <aaronecay@gmail.com> writes:
> Currently, eval macros need to quote their arguments:
>
> #+macro: identity (eval "$1")
>
> This means:
> 1. Users need to remember to put quotes around $n all the time
> 2. It’s impossible to pass arguments with a " character to a macro
This can be fixed by removing the `literal' optional argument from
`replace-regexp-in-string' call in `org-macro-expand'.
> The attached patch changes the behavior of eval macro arguments so that
> $1 etc. expand to the argument with quotation marks. That is, the
> following is now the correct way to write a macro (note lack of "s):
>
> #+macro: identity (eval $1)
I'm not totally opposed to it but it introduces a limitation: all
arguments must be strings. This is not strictly required, actually. As
a consequence, I slightly prefer fixing the current situation instead.
Is there any strong reason to force string?
> * lisp/org-macro.el (org-macro-expand): Automatically quote the
> arguments to an eval macro.
You would also need to update `org-macro-initialize-templates' and
`org-export-as'.
> + (cond
> + (evalp (format "%S" arg-val))
> + (arg-val arg-val)
Nitpick: this is equivalent to (arg-val)
Regards,
--
Nicolas Goaziou
next prev parent reply other threads:[~2015-11-05 8:38 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-11-04 14:30 [RFC] [PATCH] Automatically quote the arguments to an eval macro Aaron Ecay
2015-11-05 8:40 ` Nicolas Goaziou [this message]
2015-11-05 14:29 ` Aaron Ecay
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:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
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=874mh0q1of.fsf@nicolasgoaziou.fr \
--to=mail@nicolasgoaziou.fr \
--cc=emacs-orgmode@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* 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
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
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).