Oops; forgot to reply-all. Aaron's advice did set me straight, and #+CALL: is working fine for me now without my ill-advised debugging artifacts. Thanks to Aaron for the assistance, and to the Org list/maintainers for all the great Org tools and documentation.
Phil ----- Original Message ----- From: "Aaron Ecay" <aarone...@gmail.com> To: "Phil Regier" <preg...@ittc.ku.edu>, emacs-orgmode@gnu.org Sent: Tuesday, November 12, 2013 5:13:34 PM Subject: Re: [O] Babel #+CALL: results? 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