emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: "Eric Schulte" <schulte.eric@gmail.com>
To: R.M.Krug@gmail.com
Cc: emacs-orgmode <emacs-orgmode@gnu.org>
Subject: Re: [babel] Conditional tangling possible
Date: Tue, 31 Aug 2010 10:19:29 -0600	[thread overview]
Message-ID: <87aao292ig.fsf@gmail.com> (raw)
In-Reply-To: 4C7CBAF8.6050405@gmail.com

Hi Rainer,

Rainer M Krug <r.m.krug@gmail.com> 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

      reply	other threads:[~2010-08-31 16:21 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-08-30 11:42 [babel] Conditional tangling possible Rainer M Krug
2010-08-31  0:06 ` Eric Schulte
2010-08-31  8:19   ` Rainer M Krug
2010-08-31 16:19     ` Eric Schulte [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=87aao292ig.fsf@gmail.com \
    --to=schulte.eric@gmail.com \
    --cc=R.M.Krug@gmail.com \
    --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).