From mboxrd@z Thu Jan 1 00:00:00 1970 From: Eric Schulte Subject: Re: How do I chain babel blocks with arguments? Date: Thu, 17 Apr 2014 00:42:26 -0500 Message-ID: <87d2gg0xjc.fsf@gmail.com> References: Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:41323) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WaoW2-0007kl-G3 for emacs-orgmode@gnu.org; Thu, 17 Apr 2014 11:46:23 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WaoVx-0003qT-KB for emacs-orgmode@gnu.org; Thu, 17 Apr 2014 11:46:18 -0400 Received: from mail-ie0-x236.google.com ([2607:f8b0:4001:c03::236]:58881) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WaoVx-0003pU-ES for emacs-orgmode@gnu.org; Thu, 17 Apr 2014 11:46:13 -0400 Received: by mail-ie0-f182.google.com with SMTP id y20so543399ier.27 for ; Thu, 17 Apr 2014 08:46:11 -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: Alan Schmitt Cc: emacs-orgmode Alan Schmitt writes: > Hello, > > I have several babel blocks that each work well, but I'm now trying to > chain them to build some bigger functionality out of them. I'm having > trouble finding out how to pass arguments between blocks. Here is > a small example: > > --8<---------------cut here---------------start------------->8--- > #+name: test1 > #+begin_src emacs-lisp :var x="foo" > x > #+end_src > > #+name:test2 > #+begin_src emacs-lisp :var z="bar" :var y=test1(x=z) > y > #+end_src > > #+call: test2(z="baz") > --8<---------------cut here---------------end--------------->8--- > > Unfortunately this does not work: the evaluation of block `test2' fails > by telling me `z' does not exist. > > How can I execute block `test1' from block `test2' by passing an > argument that is one from test2? > #+name: z : bar #+name: test1 #+begin_src emacs-lisp :var x="foo" x #+end_src #+name:test2 #+begin_src emacs-lisp :var y=test1(x=z) y #+end_src #+RESULTS: test2 : bar Best, Eric > > Thanks, > > Alan > -- Eric Schulte https://cs.unm.edu/~eschulte PGP: 0x614CA05D