emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Bug? : Nested macro expansion
@ 2012-12-06 20:48 Jonathan Leech-Pepin
  2012-12-06 21:47 ` Nicolas Goaziou
  0 siblings, 1 reply; 2+ messages in thread
From: Jonathan Leech-Pepin @ 2012-12-06 20:48 UTC (permalink / raw)
  To: Org Mode Mailing List

[-- Attachment #1: Type: text/plain, Size: 1277 bytes --]

Hello all,

When trying to insert a macro as one of the variables in another macro
(inline and not in the definition), the export fails in both exporters
in different ways.

Using the following example:

#+begin_src org
#+MACRO: test2 /$1/
#+MACRO: test3 *$1*
#+MACRO: test {{{test2($1)}}} - $2
#+MACRO: test4 $1 - $2

Test
1. {{{test(hello,goodbye)}}}
2. {{{test(hello, {{{test3(goodbye)}}})}}}
3. {{{test({{{test3(hello)}}},goodbye)}}}
4. {{{test4({{{test3(hello)}}},goodbye)}}}
5. {{{test4(hello,{{{test3(goodbye)}}})}}}
#+end_src

Old exporter (ascii):

                                 Test
                                 ====
1. /hello/ - goodbye
2. /hello/ - *goodbye*
3. /*hello/ - goodbye*
4. *hello - goodbye*
5. hello - *goodbye*

New exporter (org-e-ascii-as-ascii):

Test
1. /hello/ - goodbye
2. /hello/ - *goodbye*
3. /{{{test3(hello/ - ,goodbye)}}}
4. *hello -*
5. hello - *goodbye*


The issues are with examples 3 and 4, where the interior macro does
not close any markup until after the end of the exterior macro.  The
new exporter is particularly bad, since in 3 it does not even expand
the internal macro (although it does expand it if it is part of the
original definition), and in 4 it completely omits $2 when creating
the expansion.

Regards,

--
Jon

[-- Attachment #2: Type: text/html, Size: 1515 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Bug? : Nested macro expansion
  2012-12-06 20:48 Bug? : Nested macro expansion Jonathan Leech-Pepin
@ 2012-12-06 21:47 ` Nicolas Goaziou
  0 siblings, 0 replies; 2+ messages in thread
From: Nicolas Goaziou @ 2012-12-06 21:47 UTC (permalink / raw)
  To: Jonathan Leech-Pepin; +Cc: Org Mode Mailing List

Hello,

Jonathan Leech-Pepin <jonathan.leechpepin@gmail.com> writes:

> When trying to insert a macro as one of the variables in another macro
> (inline and not in the definition), the export fails in both exporters
> in different ways.
>
> Using the following example:
>
> #+begin_src org
> #+MACRO: test2 /$1/
> #+MACRO: test3 *$1*
> #+MACRO: test {{{test2($1)}}} - $2
> #+MACRO: test4 $1 - $2
>
> Test
> 1. {{{test(hello,goodbye)}}}
> 2. {{{test(hello, {{{test3(goodbye)}}})}}}
> 3. {{{test({{{test3(hello)}}},goodbye)}}}
> 4. {{{test4({{{test3(hello)}}},goodbye)}}}
> 5. {{{test4(hello,{{{test3(goodbye)}}})}}}
> #+end_src

You're not supposed to nest macro calls. Only macro definitions.


Regards,

-- 
Nicolas Goaziou

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2012-12-06 21:51 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-12-06 20:48 Bug? : Nested macro expansion Jonathan Leech-Pepin
2012-12-06 21:47 ` Nicolas Goaziou

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).