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: Mon, 02 Dec 2013 11:41:12 +0100 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:36736) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VnQwX-0007QH-Dh for emacs-orgmode@gnu.org; Mon, 02 Dec 2013 05:41:39 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VnQwK-00030a-SL for emacs-orgmode@gnu.org; Mon, 02 Dec 2013 05:41:33 -0500 Received: from mail2-relais-roc.national.inria.fr ([192.134.164.83]:5447) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VnQwK-00030J-Lt for emacs-orgmode@gnu.org; Mon, 02 Dec 2013 05:41:20 -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: "Thomas S. Dye" Cc: emacs-orgmode@gnu.org, Charles Berry tsd@tsdye.com writes: > Alan Schmitt writes: > >> 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. > > You need :results raw at the end of the call line. > > #+name: fetchcoq2 > #+BEGIN_SRC sh :exports none :results raw :var f="demo.v" > echo "#+BEGIN_SRC coq" > echo $f > echo "#+END_SRC" > #+END_SRC > > #+results: fetchcoq2 > #+BEGIN_SRC coq > demo.v > #+END_SRC > > #+call: fetchcoq2("demo.v") :results raw > > #+results: > #+BEGIN_SRC coq > demo.v > #+END_SRC Thanks, this is helping me much. There are still one thing that I don't understand: I cannot make this work when I have already evaluated the call in the buffer. More precisely, if I have the following: --8<---------------cut here---------------start------------->8--- #+name: fetchcoq #+BEGIN_SRC sh :exports none :results raw :var f="foo.v" echo "#+BEGIN_SRC coq" head $f echo echo "#+END_SRC" #+END_SRC #+call: fetchcoq(f="demo.v") :results raw --8<---------------cut here---------------end--------------->8--- when I evaluate the call line, I get this (as expected): --8<---------------cut here---------------start------------->8--- #+name: fetchcoq #+BEGIN_SRC sh :exports none :results raw :var f="foo.v" echo "#+BEGIN_SRC coq" head $f echo echo "#+END_SRC" #+END_SRC #+call: fetchcoq(f="demo.v") :results raw #+RESULTS: #+BEGIN_SRC coq Definition toto : forall x, exists y, x = y. Lemma foo: forall x, x=x. #+END_SRC --8<---------------cut here---------------end--------------->8--- Unfortunately, if I export this, the code is duplicated. Here is the generated html, for instance: ,---- |
Definition toto : forall x, exists y, x = y.
| 
| Lemma foo: forall x, x=x.
| #+END_SRC#+BEGIN_SRC coq
| Definition toto : forall x, exists y, x = y.
| 
| Lemma foo: forall x, x=x.
| 
`---- Exporting if the result is not in the buffer is fine. I tried adding a ":results replace" as inner header argument to the call line and to the fetchcoq block, but it does not change anything. How can I tell the call line to replace the results when exporting? Thanks, Alan