From mboxrd@z Thu Jan 1 00:00:00 1970 From: Dror Atariah Subject: Scope of properties as variables for babel blocks Date: Tue, 16 Sep 2014 09:58:36 +0200 Message-ID: Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=047d7b673f145c3acc05032a1e3b Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:47055) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XTnew-00083S-54 for emacs-orgmode@gnu.org; Tue, 16 Sep 2014 03:58:50 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XTner-0003pi-ES for emacs-orgmode@gnu.org; Tue, 16 Sep 2014 03:58:46 -0400 Received: from mail-pa0-x22b.google.com ([2607:f8b0:400e:c03::22b]:65398) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XTner-0003ob-6n for emacs-orgmode@gnu.org; Tue, 16 Sep 2014 03:58:41 -0400 Received: by mail-pa0-f43.google.com with SMTP id fa1so8464892pad.2 for ; Tue, 16 Sep 2014 00:58:36 -0700 (PDT) List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: "emacs-orgmode@gnu.org" --047d7b673f145c3acc05032a1e3b Content-Type: text/plain; charset=UTF-8 #+title: Scope of properties as variables for babel blocks * Overview I have the following scenario in mind: =func1= and =func2= are two functions that can be executed in two modes: =foo= and =bar=. Each mode yields a different set of results, that have to be discussed, separately, in two different subtrees. The goal is to have one subtree where they are executed in one mode and a second subtree for the other mode. The functions are defined in a dedicated [[Code][subtree]]. * Bar setting Now, I want to execute the function in =bar= mode: #+PROPERTY: var mode="bar" #+CALL: func1() #+RESULTS: : default #+CALL: func2() #+RESULTS: : default * Foo setting In this node I want to execute the functions in =foo= mode: #+PROPERTY: var mode="foo" #+CALL: func1() #+RESULTS: : default #+CALL: func2() #+RESULTS: : default * Code #+name: func1 #+begin_src python return mode #+end_src #+RESULTS: func1 : foo #+name: func2 #+begin_src python return mode #+end_src #+RESULTS: func2 : default-val * Question: How can I implement this kind of workflow in a reproducible org mode document? --047d7b673f145c3acc05032a1e3b Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
#+title: Scope of properties as variables for babel b= locks
* Overview

I have the following sc= enario in mind: =3Dfunc1=3D and =3Dfunc2=3D are two
functions tha= t can be executed in two modes: =3Dfoo=3D and =3Dbar=3D. Each
mod= e yields a different set of results, that have to be discussed,
s= eparately, in two different subtrees.

The goal is = to have one subtree where they are executed in one mode
and a sec= ond subtree for the other mode.

The functions are = defined in a dedicated [[Code][subtree]].

* Bar se= tting

Now, I want to execute the function in =3Dba= r=3D mode:
#+PROPERTY: =C2=A0var mode=3D"bar"

#+CALL: func1()

#+RESULTS:
: default

#+CALL: func2()

<= div>#+RESULTS:
: default

* Foo setting

In this node I want to execute =C2=A0the functions = in =3Dfoo=3D mode:
#+PROPERTY: =C2=A0var mode=3D"foo"

#+CALL: func1()

#+RESULTS:=
: default

#+CALL: func2()
#+RESULTS:
: default

* Code<= /div>
#+name: func1
#+begin_src python
return mode<= /div>
#+end_src

#+RESULTS: func1
: f= oo

#+name: func2
#+begin_src python
return mode
#+end_src

#+RESULTS: f= unc2
: default-val

* Question:

How can I implement this kind of workflow in a reproducible= org mode document?
--047d7b673f145c3acc05032a1e3b--