emacs-orgmode
[Top][All Lists]
Advanced

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

Re: [O] Babel #+CALL: results?


From: Aaron Ecay
Subject: Re: [O] Babel #+CALL: results?
Date: Tue, 12 Nov 2013 18:13:34 -0500
User-agent: Notmuch/0.16+154~g96c0ce2 (http://notmuchmail.org) Emacs/24.3.50.1 (x86_64-unknown-linux-gnu)

Hi Phil,

I’m far from an expert myself, but I think I see what is going on with
your testcases.

2013ko azaroak 12an, Phil Regier-ek idatzi zuen:

[...]

> *Once* I got output, but I could not reproduce this after making and
> undoing a few formatting changes; I would chalk this up to my own
> cluelessness, except that I can get what I *think* is statefully
> incorrect output from the first block:
> 
> Iteration 1 (control case):  Begin with only the #+NAME: ... #+END_SRC with 
> ":results verbatim" and execute block to get
> 
> #+NAME: testfun
> #+BEGIN_SRC sh :var Var1="Val1" :results output verbatim
> echo "Var1:  $Var1"
> #+END_SRC
> 
> #+RESULTS: testfun
> : Var1:  Val1

So far, as expected.

>                                                                               
>        
> 
> Iteration 2:  Replace ":results output verbatim" with ":results output raw" 
> and execute block to get
> 
> #+NAME: testfun
> #+BEGIN_SRC sh :var Var1="Val1" :results output raw
> echo "Var1:  $Var1"
> #+END_SRC
> 
> #+RESULTS: testfun
> Var1:  Val1

Also as expected.

> 
> 
> Iteration 3:  Change back to ":results output verbatim" and execute block to 
> get
> 
> #+NAME: testfun
> #+BEGIN_SRC sh :var Var1="Val1" :results output verbatim
> echo "Var1:  $Var1"
> #+END_SRC
> 
> #+RESULTS: testfun
> =Var1:  Val1
> =Var1:  Val1

Now org would like to remove the previous output.  However, it cannot do
so, since it does not know where it begins and ends (since raw output
could contain in principle anything, or nothign at all).  It’s best to
use “drawer” instead of “raw” in most cases, because the drawer wrapper
bounds the result and lets subsequent calls see it and remove it.

Without removing the previous result, org tries to add the “Var1: Val1”
as verbatim text (before the instance of that text which is left over
from the previous call).  It looks like even though there is a newline
in the string org chooses to use the single-line =verbatim= syntax,
rather than the multiline
: verbatim

I don’t know why it does this, and it may be a bug.

As for your original example:
> #+CALL: testfun[:results output](Var1="Val3") :results output verbatim

You don’t need the second :results output.  That applies to an invisible
elisp source block which wraps the evaluation of the #+call line, and
which produces no output.  I get the right result consistently with

#+CALL: testfun(Var1="Val3")

#+RESULTS:
: Var1:  Val3

Or (note the addition of quotes in the result):

#+CALL: testfun(Var1="Val3") :results verbatim

#+RESULTS:
: "Var1:  Val3"

-- 
Aaron Ecay



reply via email to

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