* lisp/ob-python.el (org-babel-python-evaluate-session): Pass nil as
remove-echo part of META argument to `org-babel-comint-with-output'
The regexp matching involved in this procedure can fail on large input
data, so we only do it when necessary (i.e. output mode).
These languages are capable of writing results to file; for several of
them this is their only mode of operation. These changes cause the
languages to return to ob.el either the computed result, or nil, when
they have written results to file themselves. This is in place of the
previous method of returning the output file name as a string to
ob.el.
* lisp/ob-asymptote.el (org-babel-execute:asymptote): Return nil to
signal that the intended content has been written to file.
* lisp/ob-ditaa.el (org-babel-execute:ditaa): Return nil to signal
that the intended content has been written to file.
* lisp/ob-dot.el (org-babel-execute:dot): Return nil to signal that
the intended content has been written to file.
* lisp/ob-gnuplot.el (org-babel-execute:gnuplot): Return nil to signal
that the intended content has been written to file.
* lisp/ob-latex.el (org-babel-execute:latex): Return nil to signal
that the intended content has been written to file.
* lisp/ob-mscgen.el (org-babel-execute:mscgen): Return nil to
signal that the intended content has been written to file.
* lisp/ob-octave.el (org-babel-execute:octave): Return result; not
name of output file.
* lisp/ob-plantuml.el (org-babel-execute:plantuml): Return nil to
signal that the intended content has been written to file.
* lisp/ob-python.el (org-babel-execute:python): Return result; not
name of output file.
* lisp/ob-ruby.el (org-babel-execute:ruby): Return result; not
name of output file.
* lisp/ob-sass.el (org-babel-execute:sass): Return nil if result has
been written to file
* lisp/ob-python.el (org-babel-python-initiate-session-by-key): Make
sure that py-which-bufname is initialized, as otherwise it will be
overwritten the first time a Python buffer is created.
* lisp/ob-python.el (org-babel-execute:python): Pass the new "prefix"
header argument through to external evaluation.
(org-babel-python-evaluate): Pass the new "prefix" header argument
through to external evaluation.
(org-babel-python-evaluate-external-process): When specified prepend
"prefix" to the file used in external evaluation.
* lisp/ob-python.el (org-babel-execute:python): Use a :return header
argument for external evaluation in which the code block body need
be wrapped in a function
Thanks to Darlan Cavalcante for proposing this feature.
* lisp/ob-python.el (org-babel-python-table-or-string): Using
`org-babel-script-escape' for reading string input from scripting
languages.
* lisp/ob-ruby.el (org-babel-ruby-table-or-string): Using
`org-babel-script-escape' for reading string input from scripting
languages.
* lisp/ob.el (org-babel-script-escape): Using
`org-babel-script-escape' for reading string input from scripting
languages.
* lisp/ob-haskell.el (org-babel-haskell-table-or-string): Using
`org-babel-script-escape' for reading string input from scripting
languages.
* lisp/ob-C.el (org-babel-C-execute): removing call to
org-babel-process-params which should no longer be called from
within a language file
* lisp/ob-R.el (org-babel-execute:R): removing call to
org-babel-process-params which should no longer be called from
within a language file
(org-babel-R-variable-assignments): removing call to
org-babel-process-params which should no longer be called from
within a language file
* lisp/ob-asymptote.el (org-babel-execute:asymptote): removing call to
org-babel-process-params which should no longer be called from
within a language file
* lisp/ob-clojure.el (org-babel-execute:clojure): removing call to
org-babel-process-params which should no longer be called from
within a language file
* lisp/ob-dot.el (org-babel-execute:dot): removing call to
org-babel-process-params which should no longer be called from
within a language file
* lisp/ob-emacs-lisp.el (org-babel-expand-body:emacs-lisp): removing
call to org-babel-process-params which should no longer be called
from within a language file
(org-babel-execute:emacs-lisp): removing call to
org-babel-process-params which should no longer be called from
within a language file
* lisp/ob-haskell.el (org-babel-execute:haskell): removing call to
org-babel-process-params which should no longer be called from
within a language file
* lisp/ob-js.el (org-babel-execute:js): removing call to
org-babel-process-params which should no longer be called from
within a language file
* lisp/ob-lisp.el (org-babel-execute:lisp): removing call to
org-babel-process-params which should no longer be called from
within a language file
* lisp/ob-ocaml.el (org-babel-execute:ocaml): removing call to
org-babel-process-params which should no longer be called from
within a language file
* lisp/ob-octave.el (org-babel-execute:octave): removing call to
org-babel-process-params which should no longer be called from
within a language file
* lisp/ob-perl.el (org-babel-execute:perl): removing call to
org-babel-process-params which should no longer be called from
within a language file
* lisp/ob-python.el (org-babel-execute:python): removing call to
org-babel-process-params which should no longer be called from
within a language file
* lisp/ob-ruby.el (org-babel-execute:ruby): removing call to
org-babel-process-params which should no longer be called from
within a language file
* lisp/ob-scheme.el (org-babel-execute:scheme): removing call to
org-babel-process-params which should no longer be called from
within a language file
* lisp/ob-screen.el (org-babel-execute:screen): removing call to
org-babel-process-params which should no longer be called from
within a language file
(org-babel-prep-session:screen): removing call to
org-babel-process-params which should no longer be called from
within a language file
* lisp/ob-sh.el (org-babel-execute:sh): removing call to
org-babel-process-params which should no longer be called from
within a language file
* lisp/ob-sql.el (org-babel-execute:sql): removing call to
org-babel-process-params which should no longer be called from
within a language file
* ob-haskell.el (org-babel-execute:haskell): Remove reference
to processed params
* ob-clojure.el (org-babel-execute:clojure): Remove reference
to processed params
* ob-R.el (org-babel-execute:R): Remove reference to processed
params
* ob-python.el (org-babel-execute:python): Use generic
expansion function
(org-babel-prep-session:python): Change name of called function
(org-babel-variable-assignments:python): Change function name
(org-babel-expand-body:python): Delete function
* ob-python.el (org-babel-expand-body:python): Refactor: break variable
assignment part out into a separate function
(org-babel-python-variable-assignments): New function constructing
list of variable assignment statements
(org-babel-prep-session:python): Use new function
`org-babel-python-variable-assignments' instead of previous
(incorrect) variable assignment code.
* ob-tangle.el (org-babel-spec-to-string): Don't trim
whitespace when `org-src-preserve-indentation' is non-nil
* ob-python.el (org-babel-expand-body:python): Don't trim
whitespace when `org-src-preserve-indentation' is non-nil
Based on report and patches by Antti Kaihola.
* ob-scheme.el (org-babel-execute:scheme): Alter temp file name
* ob-ruby.el (org-babel-ruby-evaluate): Alter temp file name
* ob-python.el (org-babel-python-evaluate-external-process):
Alter temp file name
* ob-perl.el (org-babel-perl-evaluate): Alter temp file name
* ob-octave.el (org-babel-octave-evaluate-session):
Alter temp file name
(org-babel-octave-import-elisp-from-file): Alter temp file name
* ob-ledger.el (org-babel-execute:ledger): Alter temp file name
* ob-gnuplot.el (org-babel-gnuplot-process-vars): Alter temp
file name
(org-babel-execute:gnuplot): Alter temp file name
* ob.el (org-babel-process-file-name): New function
(org-babel-maybe-remote-file): Delete function
* ob-sql.el (org-babel-execute:sql):
Use org-babel-process-file-name
* ob-scheme.el (org-babel-execute:scheme):
Use org-babel-process-file-name
* ob-sass.el (org-babel-execute:sass):
Use org-babel-process-file-name
* ob-ruby.el (org-babel-ruby-evaluate):
Use org-babel-process-file-name
* ob-python.el (org-babel-python-evaluate-external-process):
Use org-babel-process-file-name
(org-babel-python-evaluate-session):
Use org-babel-process-file-name
* ob-plantuml.el (org-babel-execute:plantuml):
Use org-babel-process-file-name
* ob-perl.el (org-babel-perl-evaluate):
Use org-babel-process-file-name
* ob-octave.el (org-babel-octave-evaluate-external-process):
Use org-babel-process-file-name
(org-babel-octave-evaluate-session):
Use org-babel-process-file-name,
don't use org-babel-maybe-remote-file
* ob-lisp.el (org-babel-execute:lisp):
Use org-babel-process-file-name
* ob-ledger.el (org-babel-execute:ledger):
Use org-babel-process-file-name
* ob-js.el (org-babel-execute:js):
Use org-babel-process-file-name
* ob-haskell.el (org-babel-haskell-export-to-lhs):
Use org-babel-process-file-name
* ob-gnuplot.el (org-babel-execute:gnuplot):
Use org-babel-process-file-name
* ob-eval.el (org-babel-eval-read-file): Don't use
org-babel-maybe-remote-file
* ob-dot.el (org-babel-execute:dot):
Use org-babel-process-file-name
* ob-ditaa.el (org-babel-execute:ditaa):
Use org-babel-process-file-name
* ob-clojure.el (org-babel-clojure-evaluate-external-process):
Use org-babel-process-file-name
* ob-asymptote.el (org-babel-execute:asymptote):
Use org-babel-process-file-name
* ob-R.el (org-babel-R-assign-elisp): Don't use
org-babel-maybe-remote-file, use org-babel-process-file-name
(org-babel-R-evaluate-external-process):
Use org-babel-process-file-name
(org-babel-R-evaluate-session):
Use org-babel-process-file-name
* ob-C.el (org-babel-C-execute):
Use org-babel-process-file-name
In addition to passing the file path through `expand-file-name',
tramp-style remote file names are converted to conventional (local)
file paths. The reason is that, if a tramp file name was in use in
emacs, then the shell command will be executing on the remote machine
in question. Further, by default the file name is passed through
`shell-quote-argument'.
* ob-python.el (org-babel-python-evaluate): Refactor as call
to either `org-babel-python-evaluate-external-process' or
`org-babel-python-evaluate-session'.
(org-babel-python-evaluate-external-process): New function to
handle evaluation in external process.
(org-babel-python-evaluate-session): New function to
handle evaluation in emacs inferior process.
* lisp/ob.el (org-babel-temporary-directory): variable to hold the
value of the Babel temporary directory
(org-babel-temp-file): replacement for make-temp-file with cleanup
on exit of Emacs
(org-babel-remove-temporary-directory): cleanup function run on exit
of Emacs
(kill-emacs-hook): now includes babel cleanup function
* lisp/ob-C.el (org-babel-C-execute): using org-babel-temp-file
instead of make-temp-file
* lisp/ob-R.el (org-babel-R-assign-elisp): using `org-babel-temp-file'
instead of `make-temp-file'
(org-babel-R-evaluate-external-process): using `org-babel-temp-file'
instead of `make-temp-file'
(org-babel-R-evaluate-session): using `org-babel-temp-file' instead of
`make-temp-file'
* lisp/ob-asymptote.el (org-babel-execute:asymptote): using
`org-babel-temp-file' instead of `make-temp-file'
* lisp/ob-clojure.el (org-babel-clojure-evaluate-external-process):
using `org-babel-temp-file' instead of `make-temp-file'
* lisp/ob-ditaa.el (org-babel-execute:ditaa): using
`org-babel-temp-file' instead of `make-temp-file'
* lisp/ob-dot.el (org-babel-execute:dot): using `org-babel-temp-file'
instead of `make-temp-file'
* lisp/ob-gnuplot.el (org-babel-gnuplot-process-vars): using
`org-babel-temp-file' instead of `make-temp-file'
(org-babel-execute:gnuplot): using `org-babel-temp-file' instead of
`make-temp-file'
* lisp/ob-haskell.el (org-babel-load-session:haskell): using
`org-babel-temp-file' instead of `make-temp-file'
(org-babel-haskell-export-to-lhs): using `org-babel-temp-file' instead
of `make-temp-file'
* lisp/ob-latex.el (org-babel-execute:latex): using
`org-babel-temp-file' instead of `make-temp-file'
* lisp/ob-ledger.el (org-babel-execute:ledger): using
`org-babel-temp-file' instead of `make-temp-file'
* lisp/ob-lisp.el (org-babel-execute:lisp): using
`org-babel-temp-file' instead of `make-temp-file'
* lisp/ob-octave.el (org-babel-octave-evaluate-external-process):
using `org-babel-temp-file' instead of `make-temp-file'
(org-babel-octave-evaluate-session): using `org-babel-temp-file'
instead of `make-temp-file'
(org-babel-octave-import-elisp-from-file): using `org-babel-temp-file'
instead of `make-temp-file'
* lisp/ob-perl.el (org-babel-perl-evaluate): using
`org-babel-temp-file' instead of `make-temp-file'
* lisp/ob-python.el (org-babel-python-evaluate): using
`org-babel-temp-file' instead of `make-temp-file'
using `org-babel-temp-file' instead of `make-temp-file'
* lisp/ob-ruby.el (org-babel-ruby-evaluate): using
`org-babel-temp-file' instead of `make-temp-file'
using `org-babel-temp-file' instead of `make-temp-file'
* lisp/ob-sass.el (org-babel-execute:sass): using
`org-babel-temp-file' instead of `make-temp-file'
* lisp/ob-sh.el (org-babel-sh-evaluate): using `org-babel-temp-file'
instead of `make-temp-file'
* lisp/ob-sql.el (org-babel-execute:sql): using `org-babel-temp-file'
instead of `make-temp-file'
* lisp/ob-sqlite.el (org-babel-execute:sqlite): using
`org-babel-temp-file' instead of `make-temp-file'
(org-babel-sqlite-expand-vars): using `org-babel-temp-file' instead of
`make-temp-file'
2010-08-03 Dan Davison <davison@stats.ox.ac.uk>
* ob-python.el (org-babel-python-table-or-string): Fix
recognition of lists and tuples
Prior to this we had
#+begin_src python
return [1, 2]
#+end_src
#+results:
: [1, 2]
* lisp/ob-python.el (org-babel-python-mode): adding configuration
option to allow users to control whether they use python.el or
python-mode.el
(org-babel-python-initiate-session-by-key): updated for use with new
configuration option
For some reason ob-R refuses to compile when it requires ob-comint.
When (require 'ob-comint) is not included in ob-R.el everything
compiles without error, but warnings are thrown because the
arguments to a macro defined in ob-comint are mis-interpreted as
functions.
When (require 'ob-comint) is added to ob-R.el then it throws errors
complaining that the last argument to a function is nil and should
be a string. I don't understand this error at all and can't fix it.