[Top][All Lists]
[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: |
Tue, 31 Aug 2010 10:19:29 -0600 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux) |
Hi Rainer,
Rainer M Krug <address@hidden> writes:
> On 31/08/10 02:06, Eric Schulte wrote:
>> 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
>
> OK - that looks good. That solves one problem.
>
> But it is not actually conditional tangling? It is rather the transation
> of a tag into a variable - or am I seeing something wrong?
>
My fault, I misread your original message, something like the following
should work. You can use the uppermost elisp code block to change the
value of the tangle-tag to whichever tag you wish to be tangled.
--8<---------------cut here---------------start------------->8---
** conditional tangling
#+begin_src emacs-lisp :results silent
(setq tangle-tag "right")
#+end_src
*** first subheading :left:
#+begin_src R :tangle (and (equal (car (org-get-tags-at (point))) tangle-tag)
"yes")
"first"
#+end_src
*** second subheading :right:
#+begin_src R :tangle (and (equal (car (org-get-tags-at (point))) tangle-tag)
"yes")
"second"
#+end_src
--8<---------------cut here---------------end--------------->8---
Cheers -- Eric