From mboxrd@z Thu Jan 1 00:00:00 1970 From: Erik Iverson Subject: [PATCH] [babel] R :session should respect ess-ask-for-ess-directory set by user Date: Sat, 21 Aug 2010 13:03:25 -0500 Message-ID: <4C7014ED.4030308@biostat.wisc.edu> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Return-path: Received: from [140.186.70.92] (port=37664 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OmsnA-0007s8-FC for emacs-orgmode@gnu.org; Sat, 21 Aug 2010 14:27:45 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1Omsn9-00033C-Di for emacs-orgmode@gnu.org; Sat, 21 Aug 2010 14:27:44 -0400 Received: from pegasus.biostat.wisc.edu ([144.92.73.35]:36776) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Omsn9-00032i-7h for emacs-orgmode@gnu.org; Sat, 21 Aug 2010 14:27:43 -0400 Received: from [192.168.1.117] (c-24-118-198-210.hsd1.mn.comcast.net [24.118.198.210]) (authenticated bits=0) by pegasus.biostat.wisc.edu (8.13.6/8.13.6) with ESMTP id o7LI2bhw021146 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES128-SHA bits=128 verify=NOT) for ; Sat, 21 Aug 2010 13:02:38 -0500 (CDT) List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: emacs-orgmode Hello, I have (setq ess-ask-for-ess-directory nil) in my .emacs. I.e., I don't want to be asked to set my working directory. As it stands, if we run an R code block with the :session argument and no :dir argument, ess-ask-for-ess-directory gets set to t. I would prefer if I had it previously set to nil, to do what ESS usually does to decide which directory to use. The following patch should do that, and below is some test code to make sure it works in each of the 4 cases. --- lisp/ob-R.el | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-) diff --git a/lisp/ob-R.el b/lisp/ob-R.el index 2a11421..e767449 100644 --- a/lisp/ob-R.el +++ b/lisp/ob-R.el @@ -155,7 +155,8 @@ This function is called by `org-babel-execute-src-block'." "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 (not (cdr (assoc :dir params))))) + (ess-ask-for-ess-directory + (and ess-ask-for-ess-directory (not (cdr (assoc :dir params)))))) (if (org-babel-comint-buffer-livep session) session (save-window-excursion -- 1.7.0.4 ;; test code below (setq ess-ask-for-ess-directory t) #+begin_src R :session 2 + 2 #+end_src #+begin_src R :session :dir /tmp 2 + 2 #+end_src (setq ess-ask-for-ess-directory nil) #+begin_src R :session 2 + 2 #+end_src #+begin_src R :session :dir /tmp 2 + 2 #+end_src