From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Eric Schulte" Subject: Re: [babel] Conditional tangling possible Date: Tue, 31 Aug 2010 10:19:29 -0600 Message-ID: <87aao292ig.fsf@gmail.com> References: <4C7B9908.8090109@gmail.com> <87fwxv7iib.fsf@gmail.com> <4C7CBAF8.6050405@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Received: from [140.186.70.92] (port=56754 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OqTaX-0005mw-Pw for emacs-orgmode@gnu.org; Tue, 31 Aug 2010 12:21:34 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OqTaW-00079I-GM for emacs-orgmode@gnu.org; Tue, 31 Aug 2010 12:21:33 -0400 Received: from mail-pv0-f169.google.com ([74.125.83.169]:58707) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OqTaW-000798-Am for emacs-orgmode@gnu.org; Tue, 31 Aug 2010 12:21:32 -0400 Received: by pvc30 with SMTP id 30so5170783pvc.0 for ; Tue, 31 Aug 2010 09:21:31 -0700 (PDT) List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: R.M.Krug@gmail.com Cc: emacs-orgmode Hi Rainer, Rainer M Krug 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