[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [O] limitation for macro expansion
From: |
Yasushi SHOJI |
Subject: |
Re: [O] limitation for macro expansion |
Date: |
Mon, 06 Mar 2017 10:56:53 +0900 |
User-agent: |
Wanderlust/2.15.9 |
Hi Nicolas,
On Sun, 05 Mar 2017 19:58:43 +0900,
Nicolas Goaziou wrote:
>
> Yasushi SHOJI <address@hidden> writes:
> > * test
> > - It works with chars around like this: Aa{{{author}}}bB.
> > - It works with numbers around like this: 12{{{author}}}34.
> > - It works with _ around like this: _{{{author}}}_.
> > - It works with =__= around like this: __{{{author}}}__.
> > - But it doesn't work with 'a_' prefixed like this: a_{{{author}}}.
> > - But it doesn't work with '1_' prefixed like this: 1_{{{author}}}.
>
> The two examples above are ambiguous.
Ah, you mean the parser is unable to distinguish the macro and
subscript? I didn't notice it since I've been disabled sub /
superscript feature all together. In my configuration it seemed that
Org is silently ignoring the macro expansion. Thank you for letting
me know!
> You should use {{{{author}}}}.
Doesn't seems to work. When I export 'a_{{{{author}}}}', it
generates:
a_{Yasushi SHOJI}
I was expecting to see:
a_Yasushi SHOJI
> > - Link doesn't work like this: [[file:{{{input-file}}}][Bad link]]
>
> Indeed. This kind of link is not supported as you cannot follow it
> (macros are an export-only feature).
Hmm, that's true that you can't follow it.
Would it be OK to say that it's a design decision to ignore the macro
expansion in the link field at export time?
> Feel free to provide a documentation patch if you think this needs to be
> made explicit.
Will do once I fully understand.
Now, what I'm trying to achieve with a macro is to generate a
filename-like string with a timestamp in it in my doc.
ie)
#+MACRO: timestamp {{{date(%Y%m%d)}}}
Please open log_{{{timestamp}}}.txt
Would it be possible for org to do this?
If not, would it be possible for me to modify the code to achieve this?
My stupid idea is to:
- disable sub / superscript parser when org-use-sub-superscripts is nil
- reverse the precedence order of subscript and macro
I know parsers are in org-element.el but not sure how the precedence
is decided. If someone pointing at where to look, I'm very
appreciated.
Thanks,
--
yashi
- [O] limitation for macro expansion, Yasushi SHOJI, 2017/03/04
- Re: [O] limitation for macro expansion, Nicolas Goaziou, 2017/03/05
- Re: [O] limitation for macro expansion,
Yasushi SHOJI <=
- Re: [O] limitation for macro expansion, Nicolas Goaziou, 2017/03/06
- Re: [O] limitation for macro expansion, Yasushi SHOJI, 2017/03/06
- Re: [O] limitation for macro expansion, Nicolas Goaziou, 2017/03/06
- Re: [O] limitation for macro expansion, Yasushi SHOJI, 2017/03/07
- Re: [O] limitation for macro expansion, Nicolas Goaziou, 2017/03/08