From mboxrd@z Thu Jan 1 00:00:00 1970 From: Andreas Leha Subject: [babel] noweb reference with default values Date: Mon, 14 Dec 2015 13:28:05 +0000 Message-ID: Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:42366) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a8TAs-00011H-1I for emacs-orgmode@gnu.org; Mon, 14 Dec 2015 08:28:23 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1a8TAn-0004lD-Pu for emacs-orgmode@gnu.org; Mon, 14 Dec 2015 08:28:21 -0500 Received: from plane.gmane.org ([80.91.229.3]:43998) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a8TAn-0004kv-Im for emacs-orgmode@gnu.org; Mon, 14 Dec 2015 08:28:17 -0500 Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1a8TAj-0000D6-Ap for emacs-orgmode@gnu.org; Mon, 14 Dec 2015 14:28:13 +0100 Received: from 193.63.221.204 ([193.63.221.204]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Mon, 14 Dec 2015 14:28:13 +0100 Received: from andreas.leha by 193.63.221.204 with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Mon, 14 Dec 2015 14:28:13 +0100 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 Hi all, I'd like to hear your ideas on how to include noweb references to code blocks in a way that the default values are used as parameter values. Here is a little example: #+PROPERTY: header-args:R :session *testR* The background is that I like to use Org mode table to record small data. #+name: datatable | A | B | |---+----| | 1 | 10 | | 2 | 20 | Usually I want to pre-process and/or convert such data. #+name: read_datatable #+header: :var datatable=datatable #+begin_src R :results none datatable$B <- 10 * datatable$B #+end_src Later I would like to use that data in larger (R-) code blocks. I'd like such code blocks to DWIM: #+name: some_code #+begin_src R :noweb yes :results graphics :file testplot.png <> plot(datatable$A, datatable$B) #+end_src But they do not: They are not stand alone and do not execute -- unless I executed `read_datatable' manually/by chance upfront. My current solution is to export the table to csv and read that csv in `read_datatable'. If the result of `read_datatable' is a single table again (as in this MWE) I usually return that to Org mode which works ok. But often the result is more complex than that. I see two ways to go: - I could serialize more complex objects to disk and return a file name. But I'd prefer to not go through disk. - I could pass the same arguments as to `read_datatable' also to `some_code'. But that is duplication and becomes quite convoluted in the case of several noweb references with several arguments each. Any ideas how to do that better? Thanks, Andreas