From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Eric Schulte" Subject: Re: [babel] Conditional tangling possible Date: Mon, 30 Aug 2010 18:06:36 -0600 Message-ID: <87fwxv7iib.fsf@gmail.com> References: <4C7B9908.8090109@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Received: from [140.186.70.92] (port=36742 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OqEOc-0004Pz-OH for emacs-orgmode@gnu.org; Mon, 30 Aug 2010 20:08:15 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OqEN8-0001Zw-Ln for emacs-orgmode@gnu.org; Mon, 30 Aug 2010 20:06:44 -0400 Received: from mail-gw0-f41.google.com ([74.125.83.41]:38714) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OqEN8-0001ZU-JQ for emacs-orgmode@gnu.org; Mon, 30 Aug 2010 20:06:42 -0400 Received: by gwj16 with SMTP id 16so3282894gwj.0 for ; Mon, 30 Aug 2010 17:06:41 -0700 (PDT) In-Reply-To: <4C7B9908.8090109@gmail.com> (Rainer M. Krug's message of "Mon, 30 Aug 2010 13:42:00 +0200") 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, 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 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