From: "Eric Schulte" <schulte.eric@gmail.com>
To: Taru Karttunen <taruti@taruti.net>
Cc: emacs-orgmode <emacs-orgmode@gnu.org>
Subject: Re: [babel] #+call: result names?
Date: Mon, 15 Feb 2010 09:12:36 -0700 [thread overview]
Message-ID: <87vddymqa3.fsf@gmail.com> (raw)
In-Reply-To: <1266232415-sup-4306@oz.taruti.net> (Taru Karttunen's message of "Mon, 15 Feb 2010 13:16:59 +0200")
[-- 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
next prev parent reply other threads:[~2010-02-15 16:12 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-02-15 11:16 [babel] #+call: result names? Taru Karttunen
2010-02-15 16:12 ` Eric Schulte [this message]
2010-02-15 17:42 ` Taru Karttunen
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=87vddymqa3.fsf@gmail.com \
--to=schulte.eric@gmail.com \
--cc=emacs-orgmode@gnu.org \
--cc=taruti@taruti.net \
/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).