emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* How to intersperse commands with their output in RESULTS block?
@ 2020-02-05 17:25 Diego Zamboni
  2020-02-06  6:55 ` Fraga, Eric
  0 siblings, 1 reply; 8+ messages in thread
From: Diego Zamboni @ 2020-02-05 17:25 UTC (permalink / raw)
  To: Org-mode

[-- Attachment #1: Type: text/plain, Size: 1050 bytes --]

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

[-- Attachment #2: Type: text/html, Size: 1627 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2020-02-08 10:05 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-02-05 17:25 How to intersperse commands with their output in RESULTS block? Diego Zamboni
2020-02-06  6:55 ` Fraga, Eric
2020-02-06 20:45   ` Diego Zamboni
2020-02-07 15:26     ` Diego Zamboni
2020-02-07 15:49       ` Fraga, Eric
2020-02-07 16:07       ` Adam Porter
2020-02-07 21:30         ` Diego Zamboni
2020-02-08 10:04           ` Fraga, Eric

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).