* Babel #+CALL: results? [not found] <179869262.8638.1384295274080.JavaMail.root@ittc.ku.edu> @ 2013-11-12 22:54 ` Phil Regier 2013-11-12 23:13 ` Aaron Ecay 0 siblings, 1 reply; 3+ messages in thread From: Phil Regier @ 2013-11-12 22:54 UTC (permalink / raw To: emacs-orgmode I'm new to Babel -- I've been using Org for the last few years just to organize and typeset simple LaTeX for PDF and MathJax export -- and furthermore have had to compile Emacs from scratch and install into my home directory (installing Org as an ELPA package) to get my versions to sync up with the Worg documentation, so I may have broken something, but I've had no end of trouble trying to get even the simplest named block calls to produce output. As I understand Worg, and some old list messages from gmane, the following should produce meaningful output: #+NAME: testfun #+BEGIN_SRC sh :var Var1="Val1" echo "Var1: $Var1" #+END_SRC #+CALL: testfun[:results output](Var1="Val3") :results output verbatim #+RESULTS: : "" *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 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 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 Iteration 3+n: Execute the same 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 ==Var1: Val1 (prev. line repeated n times total) =Var1: Val1 Is this intended behavior? I will admit I don't understand Babel's output modes sufficiently well to know for sure; *however*, I also believe my one isolated success in getting output from #+CALL: was a side effect of this stateful behavior. If this is likely to be due to a bad install/configuration, can anyone clarify the "right" way to get a current org-mode installation (or at least, a version that corresponds to one or more "official" online documentation repositories) as an unprivileged user on a system that already has a prepackaged emacs installation? If this is intended behavior, where can I find the right combination of :results properties to pass output from a named block to a later call for display and/or export? Running from my current home directory installation, here are my emacs and Org versions: GNU Emacs 24.3.2 (x86_64-unknown-linux-gnu, GTK+ Version 2.18.9) of 2013-11-10 on <host> Org-mode version 8.2.2 (8.2.2-dist @ /<homedir>/.emacs.d/elpa/org-20131108/) Any guidance would be greatly appreciated... Phil Regier pregier@ittc.ku.edu ^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Babel #+CALL: results? 2013-11-12 22:54 ` Babel #+CALL: results? Phil Regier @ 2013-11-12 23:13 ` Aaron Ecay 2013-11-12 23:40 ` Phil Regier 0 siblings, 1 reply; 3+ messages in thread From: Aaron Ecay @ 2013-11-12 23:13 UTC (permalink / raw To: Phil Regier, emacs-orgmode 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 ^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Babel #+CALL: results? 2013-11-12 23:13 ` Aaron Ecay @ 2013-11-12 23:40 ` Phil Regier 0 siblings, 0 replies; 3+ messages in thread From: Phil Regier @ 2013-11-12 23:40 UTC (permalink / raw To: Aaron Ecay; +Cc: emacs-orgmode 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" <aaronecay@gmail.com> To: "Phil Regier" <pregier@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 ^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2013-11-12 23:40 UTC | newest] Thread overview: 3+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- [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 2013-11-12 23:40 ` Phil Regier
Code repositories for project(s) associated with this external index https://git.savannah.gnu.org/cgit/emacs.git https://git.savannah.gnu.org/cgit/emacs/org-mode.git This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.