emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Aaron Ecay <aaronecay@gmail.com>
To: Phil Regier <pregier@ittc.ku.edu>, emacs-orgmode@gnu.org
Subject: Re: Babel #+CALL: results?
Date: Tue, 12 Nov 2013 18:13:34 -0500	[thread overview]
Message-ID: <8738n1b4dd.fsf@gmail.com> (raw)
In-Reply-To: <1546434227.8905.1384296864359.JavaMail.root@ittc.ku.edu>

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	other threads:[~2013-11-12 23:13 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <179869262.8638.1384295274080.JavaMail.root@ittc.ku.edu>
2013-11-12 22:54 ` Babel #+CALL: results? Phil Regier
2013-11-12 23:13   ` Aaron Ecay [this message]
2013-11-12 23:40     ` Phil Regier

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=8738n1b4dd.fsf@gmail.com \
    --to=aaronecay@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=pregier@ittc.ku.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).