Merge branch 'master' of orgmode.org:org-mode

This commit is contained in:
Bastien Guerry 2012-09-23 11:42:46 +02:00
commit a14948c89f
2 changed files with 8 additions and 7 deletions

View File

@ -76,7 +76,7 @@
:version "24.1" :version "24.1"
:type 'string) :type 'string)
(defvar ess-local-process-name) (defvar ess-local-process-name) ; dynamically scoped
(defun org-babel-edit-prep:R (info) (defun org-babel-edit-prep:R (info)
(let ((session (cdr (assoc :session (nth 2 info))))) (let ((session (cdr (assoc :session (nth 2 info)))))
(when (and session (string-match "^\\*\\(.+?\\)\\*$" session)) (when (and session (string-match "^\\*\\(.+?\\)\\*$" session))
@ -201,13 +201,14 @@ This function is called by `org-babel-execute-src-block'."
name file header row-names max)))) name file header row-names max))))
(format "%s <- %s" name (org-babel-R-quote-tsv-field value)))) (format "%s <- %s" name (org-babel-R-quote-tsv-field value))))
(defvar ess-ask-for-ess-directory nil) (defvar ess-ask-for-ess-directory) ; dynamically scoped
(defun org-babel-R-initiate-session (session params) (defun org-babel-R-initiate-session (session params)
"If there is not a current R process then create one." "If there is not a current R process then create one."
(unless (string= session "none") (unless (string= session "none")
(let ((session (or session "*R*")) (let ((session (or session "*R*"))
(ess-ask-for-ess-directory (ess-ask-for-ess-directory
(and ess-ask-for-ess-directory (not (cdr (assoc :dir params)))))) (and (and (boundp 'ess-ask-for-ess-directory) ess-ask-for-ess-directory)
(not (cdr (assoc :dir params))))))
(if (org-babel-comint-buffer-livep session) (if (org-babel-comint-buffer-livep session)
session session
(save-window-excursion (save-window-excursion
@ -220,7 +221,6 @@ This function is called by `org-babel-execute-src-block'."
(buffer-name)))) (buffer-name))))
(current-buffer)))))) (current-buffer))))))
(defvar ess-local-process-name nil)
(defun org-babel-R-associate-session (session) (defun org-babel-R-associate-session (session)
"Associate R code buffer with an R session. "Associate R code buffer with an R session.
Make SESSION be the inferior ESS process associated with the Make SESSION be the inferior ESS process associated with the

View File

@ -14,9 +14,10 @@
(signal 'missing-test-dependency "Support for R code blocks")) (signal 'missing-test-dependency "Support for R code blocks"))
(ert-deftest test-ob-R/simple-session () (ert-deftest test-ob-R/simple-session ()
(org-test-with-temp-text (let ((ess-ask-for-ess-directory nil))
"#+begin_src R :session R\n paste(\"Yep!\")\n#+end_src\n" (org-test-with-temp-text
(should (string= "Yep!" (org-babel-execute-src-block))))) "#+begin_src R :session R\n paste(\"Yep!\")\n#+end_src\n"
(should (string= "Yep!" (org-babel-execute-src-block))))))
(ert-deftest test-ob-R/colnames-yes-header-argument () (ert-deftest test-ob-R/colnames-yes-header-argument ()
(org-test-with-temp-text "#+name: eg (org-test-with-temp-text "#+name: eg