From: Charles Berry <ccberry@ucsd.edu>
To: emacs-orgmode@gnu.org
Subject: Re: How do I specify the language for a :results code block
Date: Fri, 29 Nov 2013 23:48:51 +0000 (UTC) [thread overview]
Message-ID: <loom.20131130T001741-64@post.gmane.org> (raw)
In-Reply-To: m1bo12yi37.fsf@poto.westell.com
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
next prev parent reply other threads:[~2013-11-29 23:49 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-11-29 21:49 How do I specify the language for a :results code block Alan Schmitt
2013-11-29 22:10 ` Thomas S. Dye
2013-11-29 23:48 ` Charles Berry [this message]
2013-11-30 10:52 ` Alan Schmitt
2013-11-30 16:57 ` Thomas S. Dye
2013-12-02 10:41 ` Alan Schmitt
2013-12-02 11:27 ` Sebastien Vauban
2013-12-02 13:04 ` Alan Schmitt
2013-12-02 18:09 ` Sean O'Halpin
2013-12-04 13:18 ` Alan Schmitt
2013-12-04 20:06 ` Fabrice Niessen
2013-12-05 12:33 ` Alan Schmitt
2013-12-02 16:53 ` Thomas S. Dye
2013-12-04 12:35 ` Alan Schmitt
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.orgmode.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=loom.20131130T001741-64@post.gmane.org \
--to=ccberry@ucsd.edu \
--cc=emacs-orgmode@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).