From mboxrd@z Thu Jan 1 00:00:00 1970 From: Mikhail Titov Subject: Re: [babel, ess] How can I make S-RET to be multi-session friendly? Date: Tue, 14 Aug 2012 16:48:52 -0500 Message-ID: <9q0a9xxrvp7.fsf@gmx.us> References: <9q01ujfoqh2.fsf@gmx.us> <87boiidil2.fsf@gmx.com> <9q0sjbuvar7.fsf@gmx.us> <87a9y214m8.fsf@gmx.com> <87y5lh6291.fsf@gmx.com> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([208.118.235.92]:58515) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T1Oz1-0001hO-F1 for emacs-orgmode@gnu.org; Tue, 14 Aug 2012 17:49:04 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1T1Oz0-0006A9-DW for emacs-orgmode@gnu.org; Tue, 14 Aug 2012 17:49:03 -0400 Received: from mailout-us.gmx.com ([74.208.5.67]:32957) by eggs.gnu.org with smtp (Exim 4.71) (envelope-from ) id 1T1Oz0-0006A0-7S for emacs-orgmode@gnu.org; Tue, 14 Aug 2012 17:49:02 -0400 In-Reply-To: <87y5lh6291.fsf@gmx.com> (Eric Schulte's message of "Tue, 14 Aug 2012 07:17:36 -0600") List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Eric Schulte Cc: Andrew Young , emacs-orgmode@gnu.org Eric Schulte writes: > Thanks for sending this along, unfortunately ob-R.el is currently > without a core maintainer Quite a sad situation, many good modules lack maintainers :( >, so I'm not sure who on list would have the expertise to review your >submission. Although hopefully those experiencing the problem can at >least check if it works for them. I'm not an expert but I gave it a shot. >> It seems that for me, the inferior ess process is not being properly >> associated with the src edit buffer. It is being set correctly by >> org-babel-R-associate-session, and then being set a second time >> incorrectly by org-babel-edit-prep:R. Commenting out line 5 in >> org-babel-edit-prep:R seems to fix this issue, although I'm honestly >> not sure if or what it breaks. Everything seems ok for me, but ymmv. >> >> Heres the change: >> #+begin_src emacs-lisp >> (defun org-babel-edit-prep:R (info) >> (let ((session (cdr (assoc :session (nth 2 info))))) >> (when (and session (string-match "^\\*\\(.+?\\)\\*$" session)) >> (save-match-data (org-babel-R-initiate-session session nil)) >> ;;(setq ess-local-process-name (match-string 1 session))))) >> ))) >> #+end_src >> > > Perhaps replacing the commented "setq ess-local-process-name" line with > ess-switch-process could solve this problem? Could the process name be > found programatically, perhaps using the regexp solution above. > >> >> Is there any one having such issues, or who can weigh in on what >> exactly is happening here? >> >> Without making the above change, it is possible to manually attach an >> ess process to the current src buffer by using the command: >> >> C-c C-s (ess-switch-process) >> >> You'll have to specify the process name, rather than the buffer name, >> and the session must have already been started. I would say that after applying changes to my-ess-eval and to org-babel-edit-prep:R as suggested by Andrew, it looks like everything is working right for me. Once I hit C-c ' I see properly named buffer appear with new process. Then if I hit S-RET it asks me what session to use and since I have ido mode, it already highlights proper session name, so I just hit RET. Perhaps it worth recommending to use ido? Note that I do not have to enter process name. If I quite R, while editing code in a separate buffer, and hit S-RET it is executed in the wrong one without any question being asked :( I'm running somewhat recent bzr version of Emacs with default Org in it. -- Mikhail