emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [O] Org src blocks and multiline macros


From: Jarmo Hurri
Subject: Re: [O] Org src blocks and multiline macros
Date: Thu, 02 Aug 2018 15:32:57 +0300
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux)

>> I am once again facing a situation where I would like to define a
>> multiline org macro.
>
>
> I'm not sure what that means, but based on your example a different
> solution might work for you.
>
> 2. If not, could we have this feature? This would give us immediate
>>    multiline macros in the following style, where referring to the value
>>    of the variable could be done macro-style.
>>
>> #+HEADER: :var val1=foo
>> #+BEGIN_SRC org :var val2=" bar"
>>   Currently this gives me nothing but {{{val1}}}{{{val2}}}.
>> ...
>>
>
> Org macros don't get evaluated inside src blocks as far as I know. But
> Noweb might help you. Look for this feature in Org manual. I use Noweb as
> "macros for src blocks".

Yep, that will give me something similar:

#+name: val1
#+BEGIN_SRC org :exports none
foo
#+END_SRC

#+name: val2
#+BEGIN_SRC org :exports none
bar
#+END_SRC

#+BEGIN_SRC org :noweb yes
  Currently this gives me ~<<val1>><<val2>>~ indeed!
#+END_SRC

Compared to multiline macros, though, having to (re)define bunch of src
blocks for variables does seem like an overkill.

BTW, does anyone know how I could enforce the standard
Org-interpretation of '~' in the resulting, exported Org.

Jarmo




reply via email to

[Prev in Thread] Current Thread [Next in Thread]