From: "Olaf.Hamann" <O.Hamann@gmx.net>
To: emacs-orgmode@gnu.org
Subject: [Babel] tangle - kind of macro expansion inside src blocks?
Date: Mon, 14 Mar 2011 15:30:27 +0100 [thread overview]
Message-ID: <4D7E2683.9040208@gmx.net> (raw)
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
next reply other threads:[~2011-03-14 14:35 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-03-14 14:30 Olaf.Hamann [this message]
2011-03-14 15:35 ` [Babel] tangle - kind of macro expansion inside src blocks? Eric Schulte
2011-03-14 18:06 ` Olaf.Hamann
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=4D7E2683.9040208@gmx.net \
--to=o.hamann@gmx.net \
--cc=emacs-orgmode@gnu.org \
/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).