emacs-orgmode
[Top][All Lists]
Advanced

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

[O][Babel] tangle - kind of macro expansion inside src blocks?


From: Olaf.Hamann
Subject: [O][Babel] tangle - kind of macro expansion inside src blocks?
Date: Mon, 14 Mar 2011 15:30:27 +0100
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; de; rv:1.9.2.15) Gecko/20110303 Thunderbird/3.1.9

Hello all,

is there a way to do so or are there plans to integrate
a macro expansion mechanism into org-babel-tangle
like that one org-mode already provides?

#+MACRO: name replacement
{{{name}}}


I would like to replace config parameter in begin_src...end_src blocks.
Change at one place in org-file shall change values in tangled code-files.

I helped myself with an ugly hack in org-babel-tangle,
so that following lines work for me at the moment.

#+MACRO CONFIG_PARAM01 45

#+begin_src sh :tangle file1.sh
    echo org-mode set CONFIG_PARAMETER to: {{{CONFIG_PARAM01}}}
#+end_src

#+begin_src sh :tangle file2.sh
    echo org-mode set CONFIG_PARAMETER to: {{{CONFIG_PARAM01}}}
#+end_src

(this is an example only - the language which I tangle to is not good at local vars support,
so using $CONFIG_PARAMETER inside tangled code is no solution to me)

But this is no solution, so I ask whether there is already some functionality to do like this, which will nicely fit into the aspects of different languages to be used in src blocks. Work of org-babel-detangle will be harder when using such a macro functionality
(supported languages need inline comments, what to do with other? ).

Regards,
Olaf





reply via email to

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