emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Yasushi SHOJI <yashi@atmark-techno.com>
To: Nicolas Goaziou <mail@nicolasgoaziou.fr>
Cc: emacs-orgmode@gnu.org
Subject: Re: limitation for macro expansion
Date: Mon, 6 Mar 2017 18:28:19 +0900	[thread overview]
Message-ID: <CAKntEQ6aeM=-z55v5eYHL4qNzqiOzvCum9=oYav6r5sFgcEvvA@mail.gmail.com> (raw)
In-Reply-To: <87shmq4xx0.fsf@nicolasgoaziou.fr>

Hi Nicolas,

On Mon, Mar 6, 2017 at 5:22 PM, Nicolas Goaziou <mail@nicolasgoaziou.fr> wrote:
> Yasushi SHOJI <yashi@atmark-techno.com> writes:
> there are two ways to interpret it: the one you expect and
>
>   a_{CONTENTS} where CONTENTS is {{something}}.
>
> Since subscript syntax started first, it has precedence over the macro.

Yes.  That's what I understand from your response.  Thanks!

>> Doesn't seems to work.  When I export 'a_{{{{author}}}}', it
>> generates:
>>
>>   a_{Yasushi SHOJI}
>>
>> I was expecting to see:
>>
>>   a_Yasushi SHOJI
>
> This is correct if you use `ascii' back-end.

Sorry for the confusion.
I just thought that you gave me a way to use macro with underscore.

>> Would it be OK to say that it's a design decision to ignore the macro
>> expansion in the link field at export time?
>
> It is. Actually, macros are not allowed in many places, as a design
> decision. See
>
>   (info "(org) Macro replacement")
>
> for more details.

I assume that the key phrase is "anywhere Org markup is recognized".
Link format doesn't allow Org markup, right?

>> ie)
>>
>>   #+MACRO: timestamp {{{date(%Y%m%d)}}}
>>
>>   Please open log_{{{timestamp}}}.txt
>>
>> Would it be possible for org to do this?
>
> You could try
>
>   #+MACRO: timestamp {{{time(%Y%m%d)}}}
>
>   Please open log\under{}{{{timestamp()}}}.txt

Ah!  Great idea.  That's what I'm looking for. Thanks.

# I use file_name_with_underscore.txt more than subscripts
# I'd be nice, at least for me, to have '\sub' and '\super' special keywords
# but leave the underscores alone.

>> 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
>
> See `org-export-with-sub-superscripts'.

hmm.  just checked the source.  org-use-sub-superscripts is only for display.
org-export-with-sub-superscripts is just for exports.

I was gonna just by-pass or disable subscript parser all together when
org-use-sub-superscripts is nil but it doesn't seems to be a good idea, does it?

>>   - reverse the precedence order of subscript and macro
>
> This would only move the problem elsewhere.

True.
-- 
             yashi

  reply	other threads:[~2017-03-06  9:28 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-04  9:58 limitation for macro expansion Yasushi SHOJI
2017-03-05 10:58 ` Nicolas Goaziou
2017-03-06  1:56   ` Yasushi SHOJI
2017-03-06  8:22     ` Nicolas Goaziou
2017-03-06  9:28       ` Yasushi SHOJI [this message]
2017-03-06 16:41         ` Nicolas Goaziou
2017-03-07  6:18           ` Yasushi SHOJI
2017-03-08 11:30             ` 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:
  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='CAKntEQ6aeM=-z55v5eYHL4qNzqiOzvCum9=oYav6r5sFgcEvvA@mail.gmail.com' \
    --to=yashi@atmark-techno.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=mail@nicolasgoaziou.fr \
    /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).