From mboxrd@z Thu Jan 1 00:00:00 1970 From: Yasushi SHOJI Subject: Re: limitation for macro expansion Date: Mon, 06 Mar 2017 10:56:53 +0900 Message-ID: <87pohvqiai.wl@dns1.atmark-techno.com> References: <87shmt7495.wl@dns1.atmark-techno.com> <87tw786lcs.fsf@nicolasgoaziou.fr> Mime-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Content-Type: text/plain; charset=US-ASCII Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:36261) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ckidv-0000Wr-9m for emacs-orgmode@gnu.org; Sun, 05 Mar 2017 21:45:00 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ckids-00078f-6H for emacs-orgmode@gnu.org; Sun, 05 Mar 2017 21:44:59 -0500 Received: from p654789.hkidff01.ap.so-net.ne.jp ([121.101.71.137]:41541 helo=gw.atmark-techno.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ckidr-00078Y-SW for emacs-orgmode@gnu.org; Sun, 05 Mar 2017 21:44:56 -0500 Received: from mail-pg0-f70.google.com (mail-pg0-f70.google.com [74.125.83.70]) by gw.atmark-techno.com (Postfix) with ESMTPS id 493BB202A7 for ; Mon, 6 Mar 2017 11:44:50 +0900 (JST) Received: by mail-pg0-f70.google.com with SMTP id 187so37725847pgb.3 for ; Sun, 05 Mar 2017 18:44:50 -0800 (PST) In-Reply-To: <87tw786lcs.fsf@nicolasgoaziou.fr> List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: "Emacs-orgmode" To: mail@nicolasgoaziou.fr Cc: emacs-orgmode@gnu.org Hi Nicolas, On Sun, 05 Mar 2017 19:58:43 +0900, Nicolas Goaziou wrote: > > Yasushi SHOJI 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