emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Rick Moynihan <rick.moynihan@gmail.com>
To: emacs-orgmode@gnu.org
Subject: org-babel interpreter prompts
Date: Wed, 10 Feb 2010 10:52:08 +0000	[thread overview]
Message-ID: <e85471e31002100252o653e098bt88b00f29483fca3@mail.gmail.com> (raw)

Hi all,

I'm wondering if it's possible to get org-babel to output the
interpreter prompts and sessions, as if each expression in the src
block had been entered into the repl... e.g. something like:

#+begin_src ruby :output repl
10 + 10
puts "hello world"
[1,2,3,4,5,6,7,8,9,10].map do |i|
  i * i
end
#+end_src

Yielding:

#+results
: irb(main):001:0> 10 + 10
: => 20
: irb(main):002:0> puts "Hello World"
: Hello World
: => nil
: irb(main):003:0> [1,2,3,4,5,6,7,8,9,10].map do |i|
: irb(main):004:1*   i * i
: irb(main):005:1> end
: => [1, 4, 9, 16, 25, 36, 49, 64, 81, 100]
: irb(main):006:0>

The rational for this is that it lets you provide examples of being at
the prompt and write better documentation.  I'd imagine that in this
mode, you wouldn't want the original src block to be rendered, rather
just the output as if it had been run interactively.

I'd personally find this useful and would like to see this for ruby,
shell and clojure modes...  Though it'd be nice to have it work for
all the other languages and modes that support a REPL or interactive
prompt too.

-- 
Rick Moynihan
http://twitter.com/RickMoynihan
http://delicious.com/InkyHarmonics
http://sourcesmouth.co.uk/

             reply	other threads:[~2010-02-10 10:52 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-02-10 10:52 Rick Moynihan [this message]
2010-02-10 18:44 ` org-babel interpreter prompts Dan Davison

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=e85471e31002100252o653e098bt88b00f29483fca3@mail.gmail.com \
    --to=rick.moynihan@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    /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).