From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ethan Ligon Subject: Re: [Babel][Bug] Inconsistent output from babel function depending on how called Date: Thu, 26 May 2011 12:36:26 -0700 Message-ID: References: <87wrhdqozg.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Return-path: Received: from eggs.gnu.org ([140.186.70.92]:39106) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QPgMS-00083c-FM for emacs-orgmode@gnu.org; Thu, 26 May 2011 15:36:49 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QPgMR-0006kp-8j for emacs-orgmode@gnu.org; Thu, 26 May 2011 15:36:48 -0400 Received: from mail-fx0-f41.google.com ([209.85.161.41]:38355) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QPgMR-0006ki-28 for emacs-orgmode@gnu.org; Thu, 26 May 2011 15:36:47 -0400 Received: by fxm18 with SMTP id 18so1089303fxm.0 for ; Thu, 26 May 2011 12:36:46 -0700 (PDT) In-Reply-To: <87wrhdqozg.fsf@gmail.com> List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Eric Schulte Cc: "Emacs-orgmode@gnu.org" So, the ":result output org" ought to be associated with the *call*, not with the function. That makes good sense. But perhaps it still doesn't work quite as it ought... On Thu, May 26, 2011 at 11:46 AM, Eric Schulte wro= te: > Ethan Ligon writes: > >> I'd like to call a simple babel code block to generate org-code >> If I define a list thusly: >> >> #+results: list1 >> =A0- foo >> =A0- bar >> >> Then I define a code block thusly, and execute it by C-c C-c on the >> "source" line. =A0That yields the desired result: a sequence of headings >> under "#+results: print_list". >> >> #+source: print_list(lst=3Dlist1) >> #+begin_src sh :results output org >> =A0 for i in $lst; do >> =A0 =A0 echo "* $i" >> =A0 done >> #+end_src >> >> #+results: print_list >> #+BEGIN_ORG >> * foo >> * bar >> #+END_ORG >> >> Now I want to reuse the code block to generate other sequences of >> headings. =A0But even if I call it with the *same* list, instead of the >> desired headings, I get a literal, as below. >> >> #+call: print_list(lst=3Dlist1) >> >> #+results: print_list(lst=3Dlist1) >> : * foo >> : * bar >> >> I think this qualifies as a bug---surely the method of calling the >> code block shouldn't affect the output? >> > > No, this is expected (if possibly under-documented behavior). =A0The > :results header arguments are associated with the code block and *not* > with the #+call line. =A0To get the desired behavior, you must specify th= e > :results header argument on the #+call: line thusly. > > #+call: print_list(lst=3Dlist1) :results output org > If I do this, I get #+results: print_list(lst=3Dlist1) #+END_ORG #+BEGIN_ORG which is surprising first because there's no proper output, but also because the end and begin tags are reversed (!). What *does* work is to omit the "output" header argument. #+call: print_list(lst=3Dlist1) :results org #+results: print_list(lst=3Dlist1) #+BEGIN_ORG * foo * bar #+END_ORG So now I definitely have a good work-around, but still think there's a bug. Thanks, -Ethan --=20 Ethan Ligon, Associate Professor Agricultural & Resource Economics University of California, Berkeley