A couple of bug reports.

(1) Shell evaluation is broken by weird escape chars in prompt;
(2) ruby evaluation not working for me as run-ruby expects one argument on my system.

Also fixed a harmless copy-paste error and whitespace adjustment to shorten lines.
This commit is contained in:
Dan Davison 2009-06-14 14:38:15 -04:00
parent 7d063efd28
commit 70cc6cb90f
2 changed files with 79 additions and 50 deletions

View File

@ -51,10 +51,11 @@ function is called by `org-babel-execute-src-block'."
(org-babel-shell-var-to-shell (cdr pair)))) (org-babel-shell-var-to-shell (cdr pair))))
vars "\n") "\n" body "\n\n")) ;; then the source block body vars "\n") "\n" body "\n\n")) ;; then the source block body
(session (org-babel-shell-initiate-session (cdr (assoc :session params)))) (session (org-babel-shell-initiate-session (cdr (assoc :session params))))
(results (org-babel-shell-evaluate (org-babel-shell-session-buffer session) full-body result-type))) (results (org-babel-shell-evaluate (org-babel-shell-session-buffer session)
full-body result-type)))
(if (member "scalar" result-params) (if (member "scalar" result-params)
results results
(setq results (let ((tmp-file (make-temp-file "org-babel-ruby"))) (setq results (let ((tmp-file (make-temp-file "org-babel-shell")))
(with-temp-file tmp-file (insert results)) (with-temp-file tmp-file (insert results))
(org-babel-import-elisp-from-file tmp-file))) (org-babel-import-elisp-from-file tmp-file)))
(if (and (member "vector" results) (not (listp results))) (if (and (member "vector" results) (not (listp results)))

View File

@ -1718,7 +1718,35 @@ This could probably be added to [[file:lisp/org-babel-script.el][org-babel-scrip
(see [[* file result types][file result types]]) (see [[* file result types][file result types]])
* Bugs [15/18] * Bugs [15/20]
** TODO ruby evaluation not working under ubuntu emacs 23
With emacs 23.0.91.1 on ubuntu, for C-h f run-ruby I have the
following, which seems to conflict with [[file:lisp/langs/org-babel-ruby.el::let%20session%20buffer%20save%20window%20excursion%20run%20ruby%20nil%20session%20current%20buffer][this line]] in org-babel-ruby.el.
#+begin_example
run-ruby is an interactive compiled Lisp function.
(run-ruby cmd)
Run an inferior Ruby process, input and output via buffer *ruby*.
If there is a process already running in `*ruby*', switch to that buffer.
With argument, allows you to edit the command line (default is value
of `ruby-program-name'). Runs the hooks `inferior-ruby-mode-hook'
(after the `comint-mode-hook' is run).
(Type C-h m in the process buffer for a list of commands.)
#+end_example
** TODO weird escaped characters in shell prompt break shell evaluation
E.g. this doesn't work. Should the shell sessions set a sane prompt
when they start up? Or is it a question of altering
comint-prompt-regexp? Or altering org-babel regexps?
#+begin_src sh
black=30 ; red=31 ; green=32 ; yellow=33 ; blue=34 ; magenta=35 ; cyan=36 ; white=37
prompt_col=$red
prompt_char='>'
export PS1="\[\033[${prompt_col}m\]\w${prompt_char} \[\033[0m\]"
#+end_src
** TODO non-orgtbl formatted lists ** TODO non-orgtbl formatted lists
for example for example
@ -2037,28 +2065,28 @@ of these tests may fail.
#+TBLNAME: org-babel-tests #+TBLNAME: org-babel-tests
| functionality | block | arg | expected | results | pass | | functionality | block | arg | expected | results | pass |
|-------------------------+----------------------------+-----+-------------+-------------+------| |-------------------------+----------------------------+-----+-------------+-------------+---------------------------------------|
| basic evaluation | | | | | pass | | basic evaluation | | | | | pass |
|-------------------------+----------------------------+-----+-------------+-------------+------| |-------------------------+----------------------------+-----+-------------+-------------+---------------------------------------|
| emacs lisp | basic-elisp | | 5 | 5 | pass | | emacs lisp | basic-elisp | | 5 | 5 | pass |
| shell | basic-shell | | 6 | 6 | pass | | shell | basic-shell | | 6 | nil | expected "6" but was "nil" |
| ruby | basic-ruby | | org-babel | org-babel | pass | | ruby | basic-ruby | | org-babel | #ERROR | expected "org-babel" but was "#ERROR" |
| python | basic-python | | hello world | hello world | pass | | python | basic-python | | hello world | hello world | pass |
| R | basic-R | | 13 | 13 | pass | | R | basic-R | | 13 | 13 | pass |
|-------------------------+----------------------------+-----+-------------+-------------+------| |-------------------------+----------------------------+-----+-------------+-------------+---------------------------------------|
| tables | | | | | pass | | tables | | | | | pass |
|-------------------------+----------------------------+-----+-------------+-------------+------| |-------------------------+----------------------------+-----+-------------+-------------+---------------------------------------|
| emacs lisp | table-elisp | | 3 | 3 | pass | | emacs lisp | table-elisp | | 3 | 3 | pass |
| ruby | table-ruby | | 1-2-3 | 1-2-3 | pass | | ruby | table-ruby | | 1-2-3 | #ERROR | expected "1-2-3" but was "#ERROR" |
| python | table-python | | 5 | 5 | pass | | python | table-python | | 5 | 5 | pass |
| R | table-R | | 3.5 | 3.5 | pass | | R | table-R | | 3.5 | 3.5 | pass |
|-------------------------+----------------------------+-----+-------------+-------------+------| |-------------------------+----------------------------+-----+-------------+-------------+---------------------------------------|
| source block references | | | | | pass | | source block references | | | | | pass |
|-------------------------+----------------------------+-----+-------------+-------------+------| |-------------------------+----------------------------+-----+-------------+-------------+---------------------------------------|
| all languages | chained-ref-last | | Array | Array | pass | | all languages | chained-ref-last | | Array | #ERROR | expected "Array" but was "#ERROR" |
|-------------------------+----------------------------+-----+-------------+-------------+------| |-------------------------+----------------------------+-----+-------------+-------------+---------------------------------------|
| source block functions | | | | | pass | | source block functions | | | | | pass |
|-------------------------+----------------------------+-----+-------------+-------------+------| |-------------------------+----------------------------+-----+-------------+-------------+---------------------------------------|
| emacs lisp | defun-fibb | | fibbd | fibbd | pass | | emacs lisp | defun-fibb | | fibbd | fibbd | pass |
| run over | Fibonacci | 0 | 1 | 1 | pass | | run over | Fibonacci | 0 | 1 | 1 | pass |
| a | Fibonacci | 1 | 1 | 1 | pass | | a | Fibonacci | 1 | 1 | 1 | pass |
@ -2066,18 +2094,18 @@ of these tests may fail.
| of | Fibonacci | 3 | 3 | 3 | pass | | of | Fibonacci | 3 | 3 | 3 | pass |
| different | Fibonacci | 4 | 5 | 5 | pass | | different | Fibonacci | 4 | 5 | 5 | pass |
| arguments | Fibonacci | 5 | 8 | 8 | pass | | arguments | Fibonacci | 5 | 8 | 8 | pass |
|-------------------------+----------------------------+-----+-------------+-------------+------| |-------------------------+----------------------------+-----+-------------+-------------+---------------------------------------|
| bugs and tasks | | | | | pass | | bugs and tasks | | | | | pass |
|-------------------------+----------------------------+-----+-------------+-------------+------| |-------------------------+----------------------------+-----+-------------+-------------+---------------------------------------|
| simple ruby arrays | ruby-array-test | | 3 | 3 | pass | | simple ruby arrays | ruby-array-test | | 3 | #ERROR | expected "3" but was "#ERROR" |
| R number evaluation | bug-R-number-evaluation | | 2 | 2 | pass | | R number evaluation | bug-R-number-evaluation | | 2 | 2 | pass |
| multi-line ruby blocks | multi-line-ruby-test | | 2 | 2 | pass | | multi-line ruby blocks | multi-line-ruby-test | | 2 | #ERROR | expected "2" but was "#ERROR" |
| forcing vector results | test-forced-vector-results | | Array | Array | pass | | forcing vector results | test-forced-vector-results | | Array | #ERROR | expected "Array" but was "#ERROR" |
|-------------------------+----------------------------+-----+-------------+-------------+------| |-------------------------+----------------------------+-----+-------------+-------------+---------------------------------------|
| sessions | | | | | pass | | sessions | | | | | pass |
|-------------------------+----------------------------+-----+-------------+-------------+------| |-------------------------+----------------------------+-----+-------------+-------------+---------------------------------------|
| set ruby session | set-ruby-session-var | | :set | :set | pass | | set ruby session | set-ruby-session-var | | :set | #ERROR | expected ":set" but was "#ERROR" |
| get from ruby session | get-ruby-session-var | | 3 | 3 | pass | | get from ruby session | get-ruby-session-var | | 3 | #ERROR | expected "3" but was "#ERROR" |
| set python session | set-python-session-var | | set | set | pass | | set python session | set-python-session-var | | set | set | pass |
| get from python session | get-python-session-var | | 4 | 4 | pass | | get from python session | get-python-session-var | | 4 | 4 | pass |
| set R session | set-R-session-var | | set | set | pass | | set R session | set-R-session-var | | set | set | pass |
@ -2097,7 +2125,7 @@ expr 1 + 5
#+end_src #+end_src
#+srcname: date-simple #+srcname: date-simple
#+begin_src sh #+begin_src sh :results silent
date date
#+end_src #+end_src