diff --git a/lisp/langs/org-babel-R.el b/lisp/langs/org-babel-R.el index b4ec8327a..48783dbf3 100644 --- a/lisp/langs/org-babel-R.el +++ b/lisp/langs/org-babel-R.el @@ -90,7 +90,7 @@ R process in `org-babel-R-buffer'." (defun org-babel-R-initiate-session (session) "If there is not a current R process then create one." - (message "session is %S" session) + (setq session (or session "*R*")) (if (org-babel-comint-buffer-livep session) session (save-window-excursion (R) (rename-buffer (if (bufferp session) (buffer-name session) diff --git a/lisp/langs/org-babel-shell.el b/lisp/langs/org-babel-shell.el index 77e14ac8c..f1dc2e9ec 100644 --- a/lisp/langs/org-babel-shell.el +++ b/lisp/langs/org-babel-shell.el @@ -86,7 +86,9 @@ Emacs-lisp table, otherwise return the results as a string." (defun org-babel-shell-initiate-session (&optional session) "If there is not a current inferior-process-buffer in SESSION then create. Return the initialized session." - (save-window-excursion (shell session) (current-buffer))) + (save-window-excursion (shell session) + (org-babel-comint-wait-for-output (current-buffer)) + (current-buffer))) (defvar org-babel-shell-eoe-indicator "echo 'org_babel_shell_eoe'" "Used to indicate that evaluation is has completed.") diff --git a/lisp/org-babel-comint.el b/lisp/org-babel-comint.el index 38905e0ca..b9769e700 100644 --- a/lisp/org-babel-comint.el +++ b/lisp/org-babel-comint.el @@ -37,7 +37,7 @@ (require 'comint) (defun org-babel-comint-buffer-livep (buffer) - (let ((buffer (get-buffer buffer))) + (let ((buffer (if buffer (get-buffer buffer)))) (and buffer (buffer-live-p buffer) (get-buffer-process buffer) buffer))) (defmacro org-babel-comint-in-buffer (buffer &rest body) diff --git a/org-babel.org b/org-babel.org index 7f9095332..8ed4f2285 100644 --- a/org-babel.org +++ b/org-babel.org @@ -1980,14 +1980,14 @@ of these tests may fail. | shell | basic-shell | | 6 | 6 | pass | | ruby | basic-ruby | | org-babel | org-babel | pass | | python | basic-python | | hello world | hello world | pass | -| R | basic-R | | 13 | #ERROR | expected "13" but was "#ERROR" | +| R | basic-R | | 13 | 13 | pass | |-------------------------+----------------------------+-----+-------------+-------------+-----------------------------------| | tables | | | | | pass | |-------------------------+----------------------------+-----+-------------+-------------+-----------------------------------| | emacs lisp | table-elisp | | 3 | 3 | pass | | ruby | table-ruby | | 1-2-3 | 1-2-3 | pass | | python | table-python | | 5 | 5 | pass | -| R | table-R | | 3.5 | #ERROR | expected "3.5" but was "#ERROR" | +| R | table-R | | 3.5 | 3.5 | pass | |-------------------------+----------------------------+-----+-------------+-------------+-----------------------------------| | source block references | | | | | pass | |-------------------------+----------------------------+-----+-------------+-------------+-----------------------------------| @@ -2005,10 +2005,10 @@ of these tests may fail. |-------------------------+----------------------------+-----+-------------+-------------+-----------------------------------| | bugs and tasks | | | | | pass | |-------------------------+----------------------------+-----+-------------+-------------+-----------------------------------| -| simple ruby arrays | ruby-array-test | | 3 | 3 | pass | -| R number evaluation | bug-R-number-evaluation | | 2 | #ERROR | expected "2" but was "#ERROR" | -| multi-line ruby blocks | multi-line-ruby-test | | 2 | #ERROR | expected "2" but was "#ERROR" | -| forcing vector results | test-forced-vector-results | | Array | #ERROR | expected "Array" but was "#ERROR" | +| simple ruby arrays | ruby-array-test | | 3 | #ERROR | expected "3" but was "#ERROR" | +| R number evaluation | bug-R-number-evaluation | | 2 | 2 | pass | +| multi-line ruby blocks | multi-line-ruby-test | | 2 | 2 | pass | +| forcing vector results | test-forced-vector-results | | Array | Fixnum | expected "Array" but was "Fixnum" | #+TBLFM: $5='(if (= (length $3) 1) (progn (message (format "running %S" '(sbe $2 (n $3)))) (sbe $2 (n $3))) (sbe $2))::$6='(if (string= $4 $5) "pass" (format "expected %S but was %S" $4 $5)) ** basic tests