Commit Graph

32 Commits

Author SHA1 Message Date
Bastien Guerry 9c05a7c781 Bump to version 7.6 2011-07-06 21:06:03 +02:00
Julien Barnier c227da352a Fix sh block execution in session
Hi,

When evaluating shell code blocks in org-babel, the execution seems to hang
indefinitely. The following patch is trying to fix this problem by modifying
the way shell code is send to comint and the way the end-of-evaluation
indicator is looking for.

As I am far from an emacs lisp expert and as the patch modifies the widely use
org-babel-comint-with-output function, it certainly needs some testing. I've
made some tests with shell and R code blocks, but I'm not sure it's enough.

Thanks !

Julien

Fix sh block execution in a session

* lisp/ob-sh.el (org-babel-sh-evaluate) : when sending input to comint, wait
until previous line execution is finished
* lisp/ob-comint.el (org-babel-comint-with-output) : when looking for
end-of-evaluation indicator, search forward for the indicator before searching
forward for the prompt
2011-06-06 07:17:18 -06:00
Eric Schulte 03aa327d79 sh: allow passing references through STDIN of a shell script
* lisp/ob-sh.el (ob-ref): Uses ob-ref to resolve the value of the
  :stdin header argument.
  (org-babel-execute:sh): Use the :stdin header argument.
  (org-babel-sh-var-to-sh): Split the bulk of this function off into a
  new sub-function.
  (org-babel-sh-var-to-string): New function for converting elisp
  values to strings that make sense for parsing with sh.
  (org-babel-sh-evaluate): Adding "stdin" option to session and
  external evaluation options.
2011-05-25 09:52:08 -06:00
Eric Schulte f702991626 ob-sh: fixed insertion of table data into shell variables
* lisp/ob-sh.el (org-babel-sh-var-to-sh): Fixed insertion of tabular
  data into shell variables.
2011-03-21 11:20:21 -06:00
emacs 11a10bdfe7 Update website to show 7.5 as current release 2011-03-07 14:27:39 +00:00
Eric Schulte 70d338ec46 ob-sh: customize shell quoting format with org-babel-sh-var-quote-fmt.
* lisp/ob-sh.el (org-babel-sh-var-quote-fmt): Now possible to
  customize the format string used to escape arguments to shell code
  blocks.
2011-01-18 09:23:53 -07:00
Eric Schulte 19a0ca3182 ob-sh: Better escaping of variables with spaces.
* lisp/ob-sh.el (org-babel-sh-var-to-sh): Better escaping of variables
  with spaces.
2010-12-13 13:56:03 -07:00
Carsten Dominik 7666ba421f Version number back to 7.4 2010-12-10 18:49:40 +01:00
Carsten Dominik 76a25715c9 Bump version number to 7.5 2010-12-10 18:43:10 +01:00
Eric Schulte 90bd46a6d5 ob-sh: robustification
* lisp/ob-sh.el (org-babel-sh-var-to-sh): Wrap end token of heredoc in
  single quotes which is the best practice.
  (org-babel-sh-table-or-results): Use `org-babel-script-escape' for
  more robust parsing of shell output.
2010-11-23 09:38:15 -07:00
Bastien Guerry 6630edbd0f Set version number to 7.3 2010-11-07 14:52:14 +01:00
Carsten Dominik 82af72eef7 Push version number to 7.02trans 2010-10-29 09:11:46 +02:00
Dan Davison db68b1fbf5 babel: Handle non-nested list values in shell
* ob-sh.el (org-babel-sh-var-to-sh): Ensure value has the
	structure of an Org-mode table (list of lists)

Non-nested lists can arise either by explicit assignment,
e.g. :var '(1 2), or by assigning a one-dimensional slice of a table.
2010-10-21 13:06:56 +01:00
Dan Davison 369cf54146 babel:removing calls to ob-process-params, and updating use of results
* 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
2010-10-21 13:06:54 +01:00
Dan Davison 07c84b293c babel: shell: New variable assignment and expansion scheme
* ob-sh.el (org-babel-execute:sh): Use generic expansion
	function
	(org-babel-expand-body:sh): Delete function
	(org-babel-prep-session:sh): Change name of called function
	(org-babel-variable-assignments:sh): Change function name
2010-10-21 13:06:03 +01:00
Eric Schulte 2ddcf9e255 removing obsoleted optional third argument from org-babel-expand-body:LANG
* lisp/ob-C.el (org-babel-expand-body:c++): removing obsoleted
  optional third argument
  (org-babel-expand-body:c++): removing obsoleted optional third
  argument
  (org-babel-C-expand): removing obsoleted optional third argument
* lisp/ob-R.el:
  (org-babel-expand-body:R): removing obsoleted optional third
  argument
  (org-babel-execute:R): removing obsoleted optional third argument
  (org-babel-R-variable-assignments): removing obsoleted optional
  third argument
* lisp/ob-asymptote.el:
  (org-babel-expand-body:asymptote): removing obsoleted optional third
  argument
  (org-babel-execute:asymptote): removing obsoleted optional third
  argument
* lisp/ob-clojure.el:
  (org-babel-expand-body:clojure): removing obsoleted optional third
  argument
  (org-babel-execute:clojure): removing obsoleted optional third
  argument
* lisp/ob-css.el:
  (org-babel-expand-body:css): removing obsoleted optional third
  argument
* lisp/ob-ditaa.el:
  (org-babel-expand-body:ditaa): removing obsoleted optional third
  argument
* lisp/ob-dot.el:
  (org-babel-expand-body:dot): removing obsoleted optional third
  argument
  (org-babel-execute:dot): removing obsoleted optional third argument
* lisp/ob-emacs-lisp.el:
  (org-babel-expand-body:emacs-lisp): removing obsoleted optional
  third argument
  (org-babel-execute:emacs-lisp): removing obsoleted optional third
  argument
* lisp/ob-gnuplot.el:
  (org-babel-expand-body:gnuplot): removing obsoleted optional third
  argument
* lisp/ob-haskell.el:
  (org-babel-expand-body:haskell): removing obsoleted optional third
  argument
  (org-babel-execute:haskell): removing obsoleted optional third
  argument
  (org-babel-load-session:haskell): removing obsoleted optional third
  (org-babel-prep-session:haskell): removing obsoleted optional third
* lisp/ob-js.el:
  (org-babel-expand-body:js): removing obsoleted optional third
  argument
  (org-babel-execute:js): removing obsoleted optional third argument
* lisp/ob-latex.el:
  (org-babel-expand-body:latex): removing obsoleted optional third
  argument
* lisp/ob-lisp.el:
  (org-babel-expand-body:lisp): removing obsoleted optional third
  argument
  (org-babel-execute:lisp): removing obsoleted optional third argument
* lisp/ob-mscgen.el:
  (org-babel-expand-body:mscgen): removing obsoleted optional third
  argument
* lisp/ob-ocaml.el:
  (org-babel-expand-body:ocaml): removing obsoleted optional third
  argument
  (org-babel-execute:ocaml): removing obsoleted optional third
  argument
* lisp/ob-octave.el:
  (org-babel-expand-body:matlab): removing obsoleted optional third
  argument
  (org-babel-expand-body:octave): removing obsoleted optional third
  argument
  (org-babel-execute:octave): removing obsoleted optional third
  argument
  (org-babel-octave-variable-assignments): removing obsoleted optional
  third
* lisp/ob-org.el:
  (org-babel-expand-body:org): removing obsoleted optional third
  argument
* lisp/ob-perl.el:
  (org-babel-expand-body:perl): removing obsoleted optional third
  argument
  (org-babel-execute:perl): removing obsoleted optional third argument
* lisp/ob-plantuml.el:
  (org-babel-expand-body:plantuml): removing obsoleted optional third
  argument
* lisp/ob-python.el:
  (org-babel-expand-body:python): removing obsoleted optional third
  argument
  (org-babel-execute:python): removing obsoleted optional third
  argument
  (org-babel-python-variable-assignments): removing obsoleted optional
  third
* lisp/ob-ruby.el:
  (org-babel-expand-body:ruby): removing obsoleted optional third
  argument
  (org-babel-execute:ruby): removing obsoleted optional third argument
* lisp/ob-sass.el:
  (org-babel-expand-body:sass): removing obsoleted optional third
  argument
* lisp/ob-scheme.el:
  (org-babel-expand-body:scheme): removing obsoleted optional third
  argument
  (org-babel-execute:scheme): removing obsoleted optional third
  argument
* lisp/ob-screen.el:
  (org-babel-expand-body:screen): removing obsoleted optional third
  argument
* lisp/ob-sh.el:
  (org-babel-expand-body:sh): removing obsoleted optional third
  argument
  (org-babel-execute:sh): removing obsoleted optional third argument
  (org-babel-sh-variable-assignments): removing obsoleted optional
  third
* lisp/ob-sql.el:
  (org-babel-expand-body:sql): removing obsoleted optional third
  argument
* lisp/ob-sqlite.el:
  (org-babel-expand-body:sqlite): removing obsoleted optional third
  argument
  (org-babel-execute:sqlite): removing obsoleted optional third
  argument
* lisp/ob.el:
  (org-babel-expand-body:generic): removing obsoleted optional third
  argument
2010-10-21 13:06:00 +01:00
Eric Schulte f16c46c856 babel: purging all calls to removed org-babel-ref-variables
* lisp/ob-clojure.el (org-babel-prep-session:clojure): purging all
  calls to removed org-babel-ref-variables

* lisp/ob-gnuplot.el (org-babel-gnuplot-process-vars): purging all
  calls to removed org-babel-ref-variables

* lisp/ob-ruby.el (org-babel-prep-session:ruby): purging all calls to
  removed org-babel-ref-variables

* lisp/ob-scheme.el (org-babel-prep-session:scheme): purging all calls
  to removed org-babel-ref-variables

* lisp/ob-sqlite.el (org-babel-expand-body:sqlite): purging all calls
  to removed org-babel-ref-variables

  (org-babel-execute:sqlite): purging all calls to removed
  org-babel-ref-variables
2010-10-21 13:06:00 +01:00
Dan Davison 07b45a64f2 Missing parenthesis 2010-10-21 13:05:58 +01:00
Dan Davison a06ea76c53 babel: Provide missing docstrings
* ob-sh.el (org-babel-sh-variable-assignments):
	Provide missing docstring
	* ob-python.el (org-babel-python-variable-assignments):
	Provide missing docstring
2010-10-21 13:05:58 +01:00
Dan Davison 8e151c066e babel: sh: Fix variable assignments made by `org-babel-prep-session:sh'
* ob-sh.el (org-babel-expand-body:sh): Refactor: break variable
    assignment part out into a separate function
    (org-babel-sh-variable-assignments): New function constructing
    list of variable assignment statements
    (org-babel-prep-session:sh): Use new function
    `org-babel-sh-variable-assignments' instead of previous
    (incorrect) variable assignment code.
2010-10-21 13:05:58 +01:00
Eric Schulte c9b017632e ob-sh: no longer fails on empty results
* lisp/ob-sh.el (org-babel-sh-evaluate): no longer assumes that
  results are non-nil
2010-10-15 09:25:33 -06:00
Eric Schulte b04265eabc ob-sh: don't insert extra newlines in the beginning of the body
* lisp/ob-sh.el (org-babel-expand-body:sh): don't insert extra
  newlines in expanded shell bodies
2010-10-14 08:10:23 -06:00
Dan Davison 757312dde3 babel: Remove unused temporary file variable
* ob-sh.el (org-babel-sh-evaluate): Remove unused temporary
	file variable
2010-09-22 22:10:13 +01:00
Eric Schulte 7b00073f2d Babel now cleans up any temporary files created using org-babel-temp-file
* 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-25 14:47:47 -06:00
Carsten Dominik 6268cceec3 Mention release 7.01 on the website, push release number to 7.01trans 2010-07-19 08:33:24 +02:00
Eric Schulte 57bfa1989d ob-sh: can now handle variable strings which contain newlines
* lisp/ob-sh.el (org-babel-sh-var-to-sh): shell can now handle input
  strings which contain newlines
2010-07-14 11:42:06 -07:00
Tom Dye 272aefce83 Finished editing Babel docstrings 2010-07-13 16:20:08 -07:00
Eric Schulte c53fc7d246 babel: consolidate execution messaging into ob.el
* lisp/ob.el (org-babel-execute-src-block): consolidate execution
  messaging into ob.el rather than spread out amongst all the language
  files
2010-07-12 22:26:25 -07:00
Eric Schulte 33b19178fc ob-sh: bug fix, return the results *not* the contents of the user's buffer
Thanks to Bernt Hansen for pointing this out

* lisp/ob-sh.el (org-babel-sh-evaluate): return the results *not* the
  contents of the user's buffer
2010-07-06 19:53:34 -07:00
Eric Schulte 3416a0e323 babel: clean compile 2010-07-05 11:14:51 -07:00
Eric Schulte 6c2e35003f babel: all languages compiling cleanly (but R has a small problem)
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.
2010-07-05 11:14:50 -07:00
Eric Schulte d7b7025eac flattening out lisp directory structure
all babel and babel/langs files now live in the base of the lisp directory.
2010-07-05 11:14:49 -07:00
Renamed from lisp/babel/langs/ob-sh.el (Browse further)