* [babel] #+call: result names?
@ 2010-02-15 11:16 Taru Karttunen
2010-02-15 16:12 ` Eric Schulte
0 siblings, 1 reply; 3+ messages in thread
From: Taru Karttunen @ 2010-02-15 11:16 UTC (permalink / raw)
To: emacs-orgmode
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
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [babel] #+call: result names?
2010-02-15 11:16 [babel] #+call: result names? Taru Karttunen
@ 2010-02-15 16:12 ` Eric Schulte
2010-02-15 17:42 ` Taru Karttunen
0 siblings, 1 reply; 3+ messages in thread
From: Eric Schulte @ 2010-02-15 16:12 UTC (permalink / raw)
To: Taru Karttunen; +Cc: emacs-orgmode
[-- Attachment #1: Type: text/plain, Size: 631 bytes --]
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)
#+end_src
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
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: unnamed-call-results.patch --]
[-- Type: text/x-diff, Size: 622 bytes --]
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."
(save-excursion
(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))
[-- Attachment #3: Type: text/plain, Size: 1110 bytes --]
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
#+results:
...
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 <taruti@taruti.net> 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.
> Emacs-orgmode@gnu.org
> http://lists.gnu.org/mailman/listinfo/emacs-orgmode
[-- Attachment #4: Type: text/plain, Size: 201 bytes --]
_______________________________________________
Emacs-orgmode mailing list
Please use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [babel] #+call: result names?
2010-02-15 16:12 ` Eric Schulte
@ 2010-02-15 17:42 ` Taru Karttunen
0 siblings, 0 replies; 3+ messages in thread
From: Taru Karttunen @ 2010-02-15 17:42 UTC (permalink / raw)
To: Eric Schulte; +Cc: emacs-orgmode
Excerpts from Eric Schulte's message of Mon Feb 15 18:12:36 +0200 2010:
> #+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?
:resname would solve my issue.
- Taru Karttunen
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2010-02-15 17:42 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-02-15 11:16 [babel] #+call: result names? Taru Karttunen
2010-02-15 16:12 ` Eric Schulte
2010-02-15 17:42 ` Taru Karttunen
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.