From e8c977e0b38eb7eb64ed29f55bd985ca2e135c4c Mon Sep 17 00:00:00 2001 From: "Rainer M. Krug" Date: Fri, 28 Mar 2014 12:13:53 +0100 Subject: [PATCH 4/8] Rename `org_variables' to `.org_variables' * lisp/ob-R.el (org-babel-R-assign-elisp, org-babel-expand-body:R): Change name of R environment from `org_variables' to `.org_variables'. The `.' makes the environment hidden in R and it can not be directly deleted in R by using `rm(list=ls()' --- lisp/ob-R.el | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/lisp/ob-R.el b/lisp/ob-R.el index b51e582..214c14d 100644 --- a/lisp/ob-R.el +++ b/lisp/ob-R.el @@ -103,12 +103,12 @@ this variable.") (append (when (cdr (assoc :prologue params)) (list (cdr (assoc :prologue params)))) - '("try(detach(org_variables_), silent=TRUE)") - '("org_variables_ <- new.env()") + '("try(detach(.org_variables_), silent=TRUE)") + '(".org_variables_ <- new.env()") (org-babel-variable-assignments:R params) - '("lockEnvironment(org_variables_)") - '("attach(org_variables_)") - '("save(org_variables_, file='org_variables.RData')") + '("lockEnvironment(.org_variables_)") + '("attach(.org_variables_)") + '("save(.org_variables_, file='org_variables.RData')") (list body) (when (cdr (assoc :epilogue params)) (list (cdr (assoc :epilogue params))))))) @@ -208,9 +208,9 @@ This function is called by `org-babel-execute-src-block'." "TRUE" "FALSE")) (row-names (if rownames-p "1" "NULL"))) (if (= max min) - (format "assign( '%s', read.table(\"%s\", header=%s, row.names=%s, sep=\"\\t\", as.is=TRUE ), envir = org_variables_ ); lockBinding('%s', org_variables_)" name file header row-names name) - (format "assign( '%s', read.table(\"%s\", header=%s, row.names=%s, sep=\"\\t\", as.is=TRUE, fill=TRUE, col.names = paste(\"V\", seq_len(%d), sep =\"\") ), envir = org_variables_ ); lockBinding('%s', org_variables_)" name file header row-names max name)))) - (format "assign('%s', %s, envir = org_variables_); lockBinding('%s', org_variables_)" name (org-babel-R-quote-tsv-field value) name))) + (format "assign( '%s', read.table(\"%s\", header=%s, row.names=%s, sep=\"\\t\", as.is=TRUE ), envir = .org_variables_ ); lockBinding('%s', .org_variables_)" name file header row-names name) + (format "assign( '%s', read.table(\"%s\", header=%s, row.names=%s, sep=\"\\t\", as.is=TRUE, fill=TRUE, col.names = paste(\"V\", seq_len(%d), sep =\"\") ), envir = .org_variables_ ); lockBinding('%s', .org_variables_)" name file header row-names max name)))) + (format "assign('%s', %s, envir = .org_variables_); lockBinding('%s', .org_variables_)" name (org-babel-R-quote-tsv-field value) name))) (defvar ess-ask-for-ess-directory) ; dynamically scoped (defun org-babel-R-initiate-session (session params) -- 1.8.5.2 (Apple Git-48)