diff options
author | Achim Gratz <Stromeko@Stromeko.DE> | 2012-09-23 11:07:18 +0200 |
---|---|---|
committer | Achim Gratz <Stromeko@Stromeko.DE> | 2012-09-23 11:07:18 +0200 |
commit | b20ef32b9ac0bf0e6dcc5d348ed0883b82495894 (patch) | |
tree | e738be759af916b8bdf62421626b701f15d053d2 | |
parent | 348b4f3a8a5c65c7d41d2835d1159c352e79eb6d (diff) | |
download | org-mode-b20ef32b9ac0bf0e6dcc5d348ed0883b82495894.tar.gz |
do not set variables belonging to ESS
* lisp/ob-R.el (org-babel-R-initiate-session): Protect against use of
unbound variable `ess-ask-for-ess-directory´. The default for this
variable is true, so act accordingly if it is found unbound.
* lisp/ob-R.el: Remove initialization with `nil´ from
`ess-ask-for-ess-directory´ and `ess-local-process-name´. Remove
second declaration for `ess-local-process-name´.
* testing/lisp/test-ob-R.el (test-ob-R/simple-session): Bind
`ess-ask-for-ess-directory´ to nil to facilitate batch testing.
-rw-r--r-- | lisp/ob-R.el | 8 | ||||
-rw-r--r-- | testing/lisp/test-ob-R.el | 7 |
2 files changed, 8 insertions, 7 deletions
diff --git a/lisp/ob-R.el b/lisp/ob-R.el index 361428d..3dedb39 100644 --- a/lisp/ob-R.el +++ b/lisp/ob-R.el @@ -76,7 +76,7 @@ :version "24.1" :type 'string) -(defvar ess-local-process-name) +(defvar ess-local-process-name) ; dynamically scoped (defun org-babel-edit-prep:R (info) (let ((session (cdr (assoc :session (nth 2 info))))) (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)))) (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) "If there is not a current R process then create one." (unless (string= session "none") (let ((session (or session "*R*")) (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) session (save-window-excursion @@ -220,7 +221,6 @@ This function is called by `org-babel-execute-src-block'." (buffer-name)))) (current-buffer)))))) -(defvar ess-local-process-name nil) (defun org-babel-R-associate-session (session) "Associate R code buffer with an R session. Make SESSION be the inferior ESS process associated with the diff --git a/testing/lisp/test-ob-R.el b/testing/lisp/test-ob-R.el index 0ebf4d9..aec4dd0 100644 --- a/testing/lisp/test-ob-R.el +++ b/testing/lisp/test-ob-R.el @@ -14,9 +14,10 @@ (signal 'missing-test-dependency "Support for R code blocks")) (ert-deftest test-ob-R/simple-session () - (org-test-with-temp-text - "#+begin_src R :session R\n paste(\"Yep!\")\n#+end_src\n" - (should (string= "Yep!" (org-babel-execute-src-block))))) + (let ((ess-ask-for-ess-directory nil)) + (org-test-with-temp-text + "#+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 () (org-test-with-temp-text "#+name: eg |