From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Charles C. Berry" Subject: Re: org babel, ess, R Date: Wed, 5 Jul 2017 22:25:11 -0700 Message-ID: References: <87mv8o2u9b.fsf@nicolasgoaziou.fr> <3295F295-A14A-43EA-8752-53D1BEBCC31A@agrarianresearch.org> <87fuef1fov.fsf@nicolasgoaziou.fr> <829AC437-872D-453D-8543-B3C147F08B54@agrarianresearch.org> <87inj660la.fsf@nicolasgoaziou.fr> <7F043BA1-473D-444F-84D9-2ED662793C60@agrarianresearch.org> Mime-Version: 1.0 Content-Type: multipart/mixed; BOUNDARY="0-1142379404-1499318711=:1642" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:46693) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dSzI0-0006kp-3i for emacs-orgmode@gnu.org; Thu, 06 Jul 2017 01:25:21 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dSzHv-00022w-6D for emacs-orgmode@gnu.org; Thu, 06 Jul 2017 01:25:20 -0400 Received: from iport-bcv2-out.ucsd.edu ([132.239.0.73]:18805) by eggs.gnu.org with esmtps (TLS1.0:RSA_ARCFOUR_SHA1:16) (Exim 4.71) (envelope-from ) id 1dSzHu-00022L-MX for emacs-orgmode@gnu.org; Thu, 06 Jul 2017 01:25:15 -0400 In-Reply-To: <7F043BA1-473D-444F-84D9-2ED662793C60@agrarianresearch.org> 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" To: Vikas Rawal Cc: org-mode mailing list , Nicolas Goaziou This message is in MIME format. The first part should be readable text, while the remaining parts are likely unreadable without MIME-aware tools. --0-1142379404-1499318711=:1642 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8BIT On Wed, 5 Jul 2017, Vikas Rawal wrote: >>> >>> "... I'd like Org to pick up the fact that there's a :session >>> argument with a custom name and use that for C-RET in the edit buffer; >>> otherwise it generates the default *R* session there, but if you C-c >>> C-c the block later it puts it into the custom session name." >> >> This is what `org-babel-switch-to-session-with-code' does. BTW, it >> also handles Vikas' original issue of displaying both the edit buffer >> and the process buffer during editing src blocks. >> >> So you might want is to use `org-babel-switch-to-session-with-code' >> rather than `org-edit-src-code’. > > Indeed this does what I was originally looking for. How does one exit > from this neatly? What is the equivalent of org-edit-src-exit to use > with this? Using org-edit-src-exit after > org-babel-switch-to-session-with-code does not close the session window. > It doesn't do that now, but see below. >> I do not think I'd want to replace `org-edit-src-code' in >> `org-edit-special' with that function by default, since it forces a >> session to start and displays the process buffer which is kind of >> annoying when all I want to do is browse code in an edit buffer. It >> fails with an error when applied to a src block with no session, so >> that would need to be handled if `o-b-s-t-session-w-code' is supplied >> as an option. >> > > Yes, that makes sense. OTOH, maybe a call to `org-babel-switch-to-session-with-code' could replace the `(switch-to-buffer ...)' in `org-edit-special' so C-u C-c ' would display the process buffer (as it does now) and also the edit buffer and start a new process if necessary. But there are a few things to fix. `org-babel-switch-to-session-with-code' needs to set `org-src--saved-temp-window-config' after the call to 'org-edit-src-code' so `org-edit-src-exit' can restore the window setup. Also, it might as well use 'info' which `org-edit-special' obtains for src blocks when ARG is set. Chuck --0-1142379404-1499318711=:1642--