emacs-orgmode
[Top][All Lists]
Advanced

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

Re: [O] How do I specify the language for a :results code block


From: Charles Berry
Subject: Re: [O] How do I specify the language for a :results code block
Date: Fri, 29 Nov 2013 23:48:51 +0000 (UTC)
User-agent: Loom/3.14 (http://gmane.org/)

Thomas S. Dye <tsd <at> tsdye.com> writes:

> 
> Aloha Alan,
> 
> Alan Schmitt <alan.schmitt <at> polytechnique.org> writes:
> 
> > Hello,
> >
> > I'm trying to write a block in some language (right now shell, but it
> > will probably be something different) whose output is an org source
> > block is some language (here coq). I keep looking at the documentation
> > and I cannot see how to specify the language. If I try something like:
[example-deleted]

> >
> > How can I have a block with "#+BEGIN_SRC coq" instead?
[snip]
> 
> I think this can be accomplished by chaining:
> 
[example-deleted]

The problem I see is that the :var x=y() idiom can hand an object to the
src block that is hard to parse and execute -- depending on the language.

If the object is create code in one language and run it in another, it
is sometimes easier to insert results using noweb <<abc()>> calls. 

A simple example: generate code in sh that is run in emacs-lisp

#+name: make-elisp
#+BEGIN_SRC sh :exports none :var fun="+"
echo "(" $fun "1 2)"
#+END_SRC

#+BEGIN_SRC emacs-lisp :noweb yes :exports results
<<make-elisp()>>
#+END_SRC

#+RESULTS:
: 3

#+BEGIN_SRC emacs-lisp :noweb yes :exports results
<<make-elisp("-")>>
#+END_SRC

#+RESULTS:
: -1

#+BEGIN_SRC emacs-lisp :noweb yes :exports results
<<make-elisp("list")>>
#+END_SRC

#+RESULTS:
| 1 | 2 |

HTH,

Chuck




reply via email to

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