From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Eric Schulte" Subject: Re: [babel] #+call: result names? Date: Mon, 15 Feb 2010 09:12:36 -0700 Message-ID: <87vddymqa3.fsf@gmail.com> References: <1266232415-sup-4306@oz.taruti.net> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Return-path: Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Nh3Z3-00061g-HD for emacs-orgmode@gnu.org; Mon, 15 Feb 2010 11:12:49 -0500 Received: from [140.186.70.92] (port=40212 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Nh3Z2-00061J-Rt for emacs-orgmode@gnu.org; Mon, 15 Feb 2010 11:12:49 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1Nh3Z1-00010d-Oc for emacs-orgmode@gnu.org; Mon, 15 Feb 2010 11:12:48 -0500 Received: from mail-pw0-f41.google.com ([209.85.160.41]:54036) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Nh3Z1-00010T-GL for emacs-orgmode@gnu.org; Mon, 15 Feb 2010 11:12:47 -0500 Received: by pwj7 with SMTP id 7so521335pwj.0 for ; Mon, 15 Feb 2010 08:12:46 -0800 (PST) In-Reply-To: <1266232415-sup-4306@oz.taruti.net> (Taru Karttunen's message of "Mon, 15 Feb 2010 13:16:59 +0200") List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Taru Karttunen Cc: emacs-orgmode --=-=-= 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 --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=unnamed-call-results.patch 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)) --=-=-= 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 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 --=-=-= Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ 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 --=-=-=--