[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH] Possibility of using alternative separators in macros
From: |
Juan Manuel Macías |
Subject: |
[PATCH] Possibility of using alternative separators in macros |
Date: |
Fri, 30 Apr 2021 13:26:31 +0000 |
Hi all,
I would like to propose (patch attached) the possibility of using an
alternate character for separate arguments in replacement macros,
following a suggestion from Nicolas Goaziou in this (closed) thread:
87o8ead42u.fsf@nicolasgoaziou.fr/">https://orgmode.org/list/87o8ead42u.fsf@nicolasgoaziou.fr/
The idea would be to explicitly indicate the separator just before the
parentheses. The allowed characters are any character other than a
letter, a number, a space, a dash, a low line or a parenthesis.
A new property `:sep' is added to `org-element-macro-parser', whose
default value is a comma.
Example of use. Suppose we define this macro:
#+MACRO: foo (eval (format "%s and %s" $1 $2))
Under normal conditions, the expected separator will be the comma:
{{{foo(x,z\, y)}}}
=> x and z, y
But we can also do this:
{{{foo@(x@z, y \@)}}}
=> x and z, y @
I think sometimes it may be preferable to separate the arguments by an
alternative character. For example, let's imagine we define a macro
(named 'lg') for LaTeX export, which admits two arguments, exactly the
same args as the Babel (LaTeX) macro \foreignlanguage{lang}{short-text}:
{{{lg(lang,short-text)}}}.
It would be much more comfortable something like:
{{{lg|(latin|trado, tradidi, traditur)}}}
instead of having to escape commas in:
{{{lg(latin,trado\, tradidi\, traditur)}}}
Best regards,
Juan Manuel
0001-Alternative-args-separator-for-replacement-macros.patch
Description: Text Data
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [PATCH] Possibility of using alternative separators in macros,
Juan Manuel Macías <=