emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: "Olaf.Hamann" <O.Hamann@gmx.net>
To: emacs-orgmode@gnu.org
Subject: Re: var expansion on tangling only once per file
Date: Thu, 12 Apr 2012 13:18:04 +0200	[thread overview]
Message-ID: <4F86B9EC.5090707@gmx.net> (raw)
In-Reply-To: <4F86871A.6040501@gmail.com>

Am 12.04.2012 09:41, schrieb Rainer M Krug:
>
> On 11/04/12 16:15, Eric Schulte wrote:
>> Would it be possible to simply only declare the variable in a header argument applying to the
>> first code block?  Using a session would keep that variables state through all subsequent code
>> blocks.
>
> Would work - but as I said above, I would have preferred to have the variable defined at the top
> of the buffer. I could use though the no-expand header argument for the source blocks. At the moment,

What about :

#+NAME var-as-literal-block
#+BEGIN_EXAMPLE
99
#+END_EXAMPLE


#+begin_src ...  :var TheVar=var-as-literal-block
...using TheVar in code
#+end_src

----------------------------
I would prefer using Macros in this case :

#+MACRO: TheVar 99

#+begin_src ... :var TheVar={{{TheVar}}}
...using TheVar in code
#+end_src


But looks like that macros do not expand in src_block header arguments.

Regards, Olaf

      reply	other threads:[~2012-04-12 11:19 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-04-06  9:52 var expansion on tangling only once per file Rainer M Krug
2012-04-11 14:15 ` Eric Schulte
2012-04-12  7:41   ` Rainer M Krug
2012-04-12 11:18     ` Olaf.Hamann [this message]

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=4F86B9EC.5090707@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).