From mboxrd@z Thu Jan 1 00:00:00 1970 From: Alan Schmitt Subject: Re: How do I specify the language for a :results code block Date: Sat, 30 Nov 2013 11:52:56 +0100 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:47445) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VmjJ6-0006T2-Fm for emacs-orgmode@gnu.org; Sat, 30 Nov 2013 07:06:02 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VmjIw-0007g4-42 for emacs-orgmode@gnu.org; Sat, 30 Nov 2013 07:05:56 -0500 Received: from mail2-relais-roc.national.inria.fr ([192.134.164.83]:6817) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VmjIv-0007fa-UD for emacs-orgmode@gnu.org; Sat, 30 Nov 2013 07:05:46 -0500 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: Charles Berry Cc: emacs-orgmode@gnu.org Hello Thomas and Charles, ccberry@ucsd.edu writes: > A simple example: generate code in sh that is run in emacs-lisp This is almost what I want, with two differences: I don't want to run the generated code, but to pretty-print it, and I want to do this with another language than 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 > <> > #+END_SRC > > #+RESULTS: > : 3 > > #+BEGIN_SRC emacs-lisp :noweb yes :exports results > <> > #+END_SRC > > #+RESULTS: > : -1 > > #+BEGIN_SRC emacs-lisp :noweb yes :exports results > <> > #+END_SRC > > #+RESULTS: > | 1 | 2 | I tried this, but I cannot make it fit my purpose. What I want is a function that will create an org mode source block to be exported as nicely formatted source code. Here is what I tried: #+name: fetchcoq #+BEGIN_SRC sh :exports none :var f="demo.v" head $f #+END_SRC #+BEGIN_SRC coq :noweb yes :exports code <> #+END_SRC If I export this, I get a block with lists, as if the results of "fetchcoq" was translated into an elisp data structure: ,---- | (("Definition toto : forall x" "exists y" "x = y.") ("" "" "") ("Lemma foo: forall x" "x=x." "")) `---- I tried this alternate approach, to directly generate the block: #+name: fetchcoq2 #+BEGIN_SRC sh :exports none :results raw :var f="demo.v" echo "#+BEGIN_SRC coq" head $f echo echo "#+END_SRC" #+END_SRC #+call: fetchcoq2("demo.v") But then I get a result like this, with extra quoting: #+RESULTS: : #+BEGIN_SRC coq : Definition toto : forall x, exists y, x = y. : : Lemma foo: forall x, x=x. : #+END_SRC I feel like I'm missing something obvious. ":results code" is exactly what I want (put the results in a SRC block), but I don't know how to specify the headers of the generated code block. Thanks, Alan