From mboxrd@z Thu Jan 1 00:00:00 1970 From: Diego Zamboni Subject: How to intersperse commands with their output in RESULTS block? Date: Wed, 5 Feb 2020 18:25:39 +0100 Message-ID: Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="000000000000b4d525059dd7720c" Return-path: Received: from eggs.gnu.org ([2001:470:142:3::10]:42787) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1izOR3-0005DT-Mz for emacs-orgmode@gnu.org; Wed, 05 Feb 2020 12:25:59 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1izOR1-00056y-AO for emacs-orgmode@gnu.org; Wed, 05 Feb 2020 12:25:57 -0500 Received: from mail-wr1-x433.google.com ([2a00:1450:4864:20::433]:33888) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1izOQz-0004uu-UC for emacs-orgmode@gnu.org; Wed, 05 Feb 2020 12:25:55 -0500 Received: by mail-wr1-x433.google.com with SMTP id t2so3766015wrr.1 for ; Wed, 05 Feb 2020 09:25:52 -0800 (PST) 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-mx.org@gnu.org Sender: "Emacs-orgmode" To: Org-mode --000000000000b4d525059dd7720c Content-Type: text/plain; charset="UTF-8" Hi everyone, tl;dr: is there a way to have ob-shell (or some similar mode) run commands one by one and include the commands, interspersed with their output, in the #+RESULTS block? I would like to have examples shown with commands, followed by their output. Something like this: #+begin_src console > echo "hi" hi > echo "bye" bye #+end_src This works well for my use case - "console" blocks are understood nicely by Pygmentize as containing both commands and output. What I would like is to start using org-babel to run the commands and insert their output in the export, so that I can update the examples without having to copy-paste from the terminal. So what I would like is to have something like this: #+begin_src sh :exports results :wrap "src console" echo "hi" echo "bye" #+end_src And when I evaluate the block with C-c C-c, I get: #+results: #+begin_src console > echo "hi" hi > echo "bye" bye #+end_src Before I start building my own, ob-mode I was wondering if anyone knows of any existing way to achieve this. Thanks! --Diego --000000000000b4d525059dd7720c Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Hi everyone,

tl;dr: is= there a way to have ob-shell (or some similar mode) run commands one by on= e and include the commands, interspersed with their output, in the #+RESULT= S block?

I would like to have examples shown with = commands, followed by their output. Something like this:

#+begin_src console
> echo "hi"
hi<= /div>
> echo "bye"
bye
#+end_src
=

This works well for my use case - "cons= ole" blocks are understood nicely by Pygmentize as containing both com= mands and output.

What I would like is to start us= ing org-babel to run the commands and insert their output in the export, so= that I can update the examples without having to copy-paste from the termi= nal. So what I would like is to have something like this:

#+begin_src sh :exports results :wrap "src console"
=
echo "hi"
echo "bye"
#+end_src=

And when I evaluate the block with C-c C-c, I get= :

#+results:
#+begin_src console
> echo "hi"
hi
> echo &qu= ot;bye"
bye
#+end_src

Bef= ore I start building my own, ob-mode I was wondering if anyone knows of any= existing way to achieve this.

Thanks!
-= -Diego


--000000000000b4d525059dd7720c--