From: "Sean O'Halpin" <sean.ohalpin@gmail.com>
To: Alan Schmitt <alan.schmitt@polytechnique.org>
Cc: Sebastien Vauban <sva-news@mygooglest.com>,
Org Mode <emacs-orgmode@gnu.org>
Subject: Re: How do I specify the language for a :results code block
Date: Mon, 2 Dec 2013 18:09:55 +0000 [thread overview]
Message-ID: <CAOXM+eWdn-MR=ufvsVSHtWoxmp1MKKWwBkbLqV1T5UV19SZPeg@mail.gmail.com> (raw)
In-Reply-To: <m2d2lfflp3.fsf@polytechnique.org>
Hi,
Taking a slightly different approach, you could use the :post header
argument to wrap the results in a source block.
See http://orgmode.org/org.html#post (from which the example below is derived).
For example, you could use something like this:
#+OPTIONS: d:RESULTS
* Example
#+name: eg-1
#+begin_src sh :results replace drawer :exports results :post
wrap-src(text=*this*)
head -n 3 demo.v
#+end_src
Output
#+results: eg-1
* Utils :noexport:
#+name: wrap-src
#+begin_src emacs-lisp :var text="" :results raw
(concat "#+BEGIN_SRC coq\n" text "\n#+END_SRC")
#+end_src
BTW I answered a question similar to this on Stack Overflow recently
(http://stackoverflow.com/questions/20194347/org-mode-with-code-example-as-html/20232922#20232922)
- must be something in the air.
Regards,
Sean
On Mon, Dec 2, 2013 at 1:04 PM, Alan Schmitt
<alan.schmitt@polytechnique.org> wrote:
> Hi Sébastien,
>
> sva-news@mygooglest.com writes:
>
>>> 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?
>>
>> The syntax of the call line is:
>>
>> #+call: <NAME>[<HEADER-ARGS-FOR-BLOCK>](<ARGUMENTS>) <HEADER-ARGS-FOR-CALL-LINE>
>>
>> So, you should add your option either in [] after the name, or at the end of
>> the line -- I'm always hesitating about where to put the right stuff (not so
>> enough clear yet in my mind)...
>
> I tried both, and neither works. Here is an org file showing the
> problem:
>
> --8<---------------cut here---------------start------------->8---
> #+name: testcall
> #+BEGIN_SRC sh :exports none :results raw
> echo "#+BEGIN_SRC emacs-lisp"
> echo "(+ 1 2)"
> echo "#+END_SRC"
> #+END_SRC
>
> Test fails:
> #+call: testcall() :results raw
>
> #+RESULTS:
> #+BEGIN_SRC emacs-lisp
> (+ 1 2)
> #+END_SRC
>
> Test fails:
> #+call: testcall[:results replace]() :results raw
>
> #+RESULTS:
> #+BEGIN_SRC emacs-lisp
> (+ 1 2)
> #+END_SRC
>
> Test fails:
> #+call: testcall() :results raw replace
>
> #+RESULTS:
> #+BEGIN_SRC emacs-lisp
> (+ 1 2)
> #+END_SRC
>
> Test succeeds (results not already in the file):
> #+call: testcall() :results raw
> --8<---------------cut here---------------end--------------->8---
>
> If you export this, you'll see that only the last call generates the
> expected output.
>
> Alan
>
next prev parent reply other threads:[~2013-12-02 18:10 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
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 [this message]
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='CAOXM+eWdn-MR=ufvsVSHtWoxmp1MKKWwBkbLqV1T5UV19SZPeg@mail.gmail.com' \
--to=sean.ohalpin@gmail.com \
--cc=alan.schmitt@polytechnique.org \
--cc=emacs-orgmode@gnu.org \
--cc=sva-news@mygooglest.com \
/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).