From mboxrd@z Thu Jan 1 00:00:00 1970 From: Rick Frankel Subject: Re: input data for babel blocks Date: Tue, 01 Oct 2013 10:29:49 -0400 Message-ID: <354a40d3e967378379adfecadf7d4af4@mail.rickster.com> References: <87r4c5p456.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:39754) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VR0xX-0008N5-0h for emacs-orgmode@gnu.org; Tue, 01 Oct 2013 10:30:00 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VR0xS-00062C-2Z for emacs-orgmode@gnu.org; Tue, 01 Oct 2013 10:29:54 -0400 Received: from [204.62.15.78] (port=55537 helo=mail.rickster.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VR0xR-000624-Uq for emacs-orgmode@gnu.org; Tue, 01 Oct 2013 10:29:49 -0400 In-Reply-To: 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: Alan Schmitt Cc: emacs-orgmode@gnu.org, Charles Berry , Eric Schulte On 2013-10-01 09:01, Alan Schmitt wrote: > I'm sorry, I don't see the answer to this above. The only example I > could find in the manual is this one > http://orgmode.org/manual/noweb_002dref.html#noweb_002dref which does > not address using noweb with different languages. > > I did some experiments and I'm even more confused. Here is a test where > I want to feed the results of "ls" in a shell block as an ocaml > list. This is what I tried: > > #+BEGIN_SRC sh :noweb-ref testing > echo "[" > for i in `ls`; do > echo \"$i;\" > done > echo "]" > #+END_SRC > > #+BEGIN_SRC ocaml :noweb yes > let x = > <> > in x > #+END_SRC > > This is clearly wrong because this is what ends up in the toplevel: > > let x = > echo "[" > for i in `ls`; do > echo \"$i;\" > done > echo "]" > in x;; > You're close. The noweb ref should be a named src block which is executed, not expanded, so, (note the named shell source block and the parens in the noweb reference): #+name: testing #+BEGIN_SRC sh :results raw echo "[" ls *.org | sed 's/$/;/' echo "]" #+END_SRC #+BEGIN_SRC ocaml :noweb yes let x = <> in x #+END_SRC rick