[Top][All Lists]

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

Re: [Orgmode] [babel] #+call: result names?

From: Eric Schulte
Subject: Re: [Orgmode] [babel] #+call: result names?
Date: Mon, 15 Feb 2010 09:12:36 -0700
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1.90 (gnu/linux)

Hi Taru,

Thanks for pointing this out.

I'm not sure what the cleanest way would be to refer to these results.
I find that in these situations if I were to try to refer the results of
a call line like

#+call: foo(x="bar")

with something like

#+begin_src emacs-lisp :var foobar=foo(x="bar")
  (message "foo of bar is %S" foobar)

Org-babel will end up re-running the foo function passing "bar" as an
argument.  This is generally fine with me as it will return the same
value as referencing the results of the #+call line.

The easiest solution would be to simply un-name all #+call results.
This tiny patch does this

diff --git a/contrib/babel/lisp/org-babel.el b/contrib/babel/lisp/org-babel.el
index 01b730d..4e3e70c 100644
--- a/contrib/babel/lisp/org-babel.el
+++ b/contrib/babel/lisp/org-babel.el
@@ -628,7 +628,7 @@ following the source block."
     (let* ((on-lob-line (progn (beginning-of-line 1)
                               (looking-at org-babel-lob-one-liner-regexp)))
-          (name (if on-lob-line (first (org-babel-lob-get-info))
+          (name (unless on-lob-line
                   (fifth (or info (org-babel-get-src-block-info)))))
           (head (unless on-lob-line (org-babel-where-is-src-block-head))) end)
       (when head (goto-char head))
However the cleanest solution to me seems to be adding a header
argument, maybe named :resname which could be used to control the name
of the results, then passing an empty :resname argument could result in
the following

#+call: foo(x="bar") :resname


and supplying a value would allow specific naming

#+call: foo(x="bar") :resname eric

#+results: eric

Does that sound like a good solution?  Is anyone using results names in
another way which this would not address?

Thanks -- Eric

Taru Karttunen <address@hidden> writes:

> Hello
> I have code like
> #+call: foo(x="bar")
> that produces
> #+results: foo(x="bar")
> ...
> Referring to the results with such a name elsewhere does not seem to
> work and is tedious. Is there a way to to rename the results?
> i.e.
> #+call: foo(x="bar") as foobar
> producing
> #+results: foobar
> - Taru Karttunen
> _______________________________________________
> Emacs-orgmode mailing list
> Please use `Reply All' to send replies to the list.
> address@hidden
> http://lists.gnu.org/mailman/listinfo/emacs-orgmode

reply via email to

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