emacs-orgmode
[Top][All Lists]
Advanced

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

Re: [Orgmode] [babel] Conditional tangling possible


From: Eric Schulte
Subject: Re: [Orgmode] [babel] Conditional tangling possible
Date: Mon, 30 Aug 2010 18:06:36 -0600
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux)

Hi Rainer,

The easiest way to do this should be,

--8<---------------cut here---------------start------------->8---
** pulling information from tags                                       :blue:

#+begin_src R :var color=(car (org-get-tags-at (point))) :tangle example.R
  color
#+end_src

#+results:
: blue
--8<---------------cut here---------------end--------------->8---

this will tangle to

--8<---------------cut here---------------start------------->8---
color <- "blue"
color
--8<---------------cut here---------------end--------------->8---

Cheers -- Eric

Rainer M Krug <address@hidden> writes:

> Hi
>
> I would like to have two different versions (not in the sense of version
> control) of one program in one org file, and depending on the value if a
> tag is set or not, tangle either the one or the other. The tangled file
> has to have the same name.
>
> So essentially:
>
>
>
> ** Test Code              :VERSIONTAG
> Version 1:
> #+begin_src R :tangle result.R
>   version <- 1
>   x <- 10
> #+end_src
>
> Version 2:
> #+begin_src R :tangle result.R
>   version <- 2
>   x <- 13
> #+end_src
>
> If VERSIONTAG is Version1, result.R should contain the code as in the
> first code block, and if it is Version2, the code from the second code
> block.
>
>
> Is this possible?
>
> Cheers,
>
> Rainer



reply via email to

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