From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Charles C. Berry" Subject: Re: Referring to an Org Babel variable in the invocation arguments to another Org Babel code block Date: Sun, 1 Jan 2017 10:51:38 -0800 Message-ID: References: <87inq51q4o.fsf@apertron.net> <87h95p1bm2.fsf@apertron.net> <87d1gan3bl.fsf@nicolasgoaziou.fr> <7c1389a5-10f5-dd79-5764-137ab48a9013@apertron.net> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:48934) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cNlEQ-0006yb-DH for emacs-orgmode@gnu.org; Sun, 01 Jan 2017 13:51:47 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cNlEN-0004ka-9j for emacs-orgmode@gnu.org; Sun, 01 Jan 2017 13:51:46 -0500 Received: from iport-bcv2-out.ucsd.edu ([132.239.0.73]:58170) by eggs.gnu.org with esmtps (TLS1.0:RSA_ARCFOUR_SHA1:16) (Exim 4.71) (envelope-from ) id 1cNlEM-0004ib-OR for emacs-orgmode@gnu.org; Sun, 01 Jan 2017 13:51:43 -0500 In-Reply-To: <7c1389a5-10f5-dd79-5764-137ab48a9013@apertron.net> 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" To: Zack Piper Cc: emacs-orgmode@gnu.org On Sun, 1 Jan 2017, Zack Piper wrote: > Hi Nicolas, > I tried "c", and it gives me: > >>>> c <<< > > as the result. > > I would like it to use the _variable_ "c", not the literal string. > So the result should be ">>> test <<<" > You mean you want to use the `name' of one `:var name=assign' argument in the `assign' part of another --- something like what `let*' does in lisp. But you simply cannot do that. `(info "(org) var")' tells us what you can do: #+BEGIN_QUOTE The following syntax is used to pass arguments to `src' code blocks using the `:var' header argument. :var name=assign The `assign' is a literal value, such as a string `"string"', a number `9', a reference to a table, a list, a literal example, another code block (with or without arguments), or the results from evaluating a code block. #+END_QUOTE The `name' of one argument is none of these (regardless of its effect when the body of the src block is executed, which BTW depends on the src block language). There are other approaches that might serve a purpose in babel src blocks like that served by `let*' in lisp: - putting variables in a table (possibly invoking `org-sbe' in a formula) and then referencing table cells - writing other src blocks to handle the preliminary processing and referncing them - writing an elisp src block that does those preliminaries (perhaps using `org-babel-ref-resolve' to call other src blocks), then builds a string specifying a call to your shell src block and calls it using `org-babel-ref-resolve'. - using a noweb reference that executes another src block (or blocks). - setting property values and referencing them You might have better luck getting guidance on a useful approach by trying to describe what you want to accomplish. HTH, Chuck