emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [O] input data for babel blocks


From: Alan Schmitt
Subject: Re: [O] input data for babel blocks
Date: Tue, 01 Oct 2013 15:01:10 +0200
User-agent: mu4e 0.9.9.5; emacs 24.3.1

Hi Eric,

address@hidden writes:

>> What I don't understand is:
>> - how to define this function;
>
> It is not a function name, it is a code block name.  See the noweb
> section of the Org-mode manual for more information.

OK.

>> - will it be evaluated as a "mylang" function or as a function in the
>> language it is defined?
>>
>> In other words, do we have "evaluate elisp-conversion-to-mylang in its
>> language then substitute the results in the noweb block" or "substitute
>> the function in the noweb block then evaluate it"?
>>
>
> see above

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:

--8<---------------cut here---------------start------------->8---
#+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 =
<<testing>>
in x
#+END_SRC
--8<---------------cut here---------------end--------------->8---

This is clearly wrong because this is what ends up in the toplevel:

--8<---------------cut here---------------start------------->8---
let x =
echo "["
for i in `ls`; do
  echo \"$i;\"
done
echo "]"
in x;;
--8<---------------cut here---------------end--------------->8---

(I would have like the code to be executed, and the raw results to
replace the <<testing>> ref.)

So I'll rephrase my question: how can I use noweb with different
languages?

Thanks,

Alan



reply via email to

[Prev in Thread] Current Thread [Next in Thread]