From: Eric Schulte <schulte.eric@gmail.com>
To: Herbert Sitz <hsitz@nwlink.com>
Cc: emacs-orgmode@gnu.org
Subject: Re: Batch mode evaluation of source code?
Date: Fri, 17 Jun 2011 14:47:00 -0700 [thread overview]
Message-ID: <8762o4ruzv.fsf@gmail.com> (raw)
In-Reply-To: <loom.20110617T230734-356@post.gmane.org> (Herbert Sitz's message of "Fri, 17 Jun 2011 21:14:25 +0000 (UTC)")
[-- Attachment #1: Type: text/plain, Size: 342 bytes --]
Hi Herb,
The following org-mode file and minimal elisp file can be used to print
the results of evaluating a code block from a batch Emacs session (note
this is using Emacs24, so Org-mode/Babel do not need to be explicitly
loaded).
I used the following command line
: emacs --batch -l run-code.el 2> /dev/null
And the following two files.
[-- Attachment #2: run-code.el --]
[-- Type: application/emacs-lisp, Size: 242 bytes --]
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #3: short-code.org --]
[-- Type: text/x-org, Size: 134 bytes --]
#+Title: short code buffer
#+begin_src python :results output
print "hello"
2
print "bye"
#+end_src
#+results:
: hello
: bye
[-- Attachment #4: Type: text/plain, Size: 767 bytes --]
Cheers -- Eric
Herbert Sitz <hsitz@nwlink.com> writes:
> The Org manual gives an example of a batch mode --eval that runs code to tangle
> code from Org files. I assume there's also a way to simply run a source code
> block and get its output in the terminal but I can't see how to do it.
>
> To give a concrete example, the Org manual uses this Python source block as
> example illustrating the difference between :session and non-session results
> output. How would I evaluate it from the command line and get the results
> output back in the terminal?:
>
> -------------------------
> #+begin_src python :results output
> print "hello"
> 2
> print "bye"
> #+end_src
> ------------------------
>
> -- Herb
>
>
>
--
Eric Schulte
http://cs.unm.edu/~eschulte/
next prev parent reply other threads:[~2011-06-17 21:47 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-06-17 21:14 Batch mode evaluation of source code? Herbert Sitz
2011-06-17 21:47 ` Eric Schulte [this message]
2011-06-17 22:45 ` Herbert Sitz
2011-06-17 22:55 ` Herbert Sitz
2011-06-17 23:02 ` Nick Dokos
2011-06-17 23:10 ` Herbert Sitz
2011-06-17 23:05 ` Eric Schulte
2011-06-18 0:17 ` Herbert Sitz
2011-06-18 7:32 ` Achim Gratz
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=8762o4ruzv.fsf@gmail.com \
--to=schulte.eric@gmail.com \
--cc=emacs-orgmode@gnu.org \
--cc=hsitz@nwlink.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).