[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [O] Referring to an Org Babel variable in the invocation arguments t

From: Charles C. Berry
Subject: Re: [O] 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
User-agent: Alpine 2.20 (OSX 67 2015-01-07)

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:


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.


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.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]