[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [O] org babel, ess, R

From: Charles C. Berry
Subject: Re: [O] org babel, ess, R
Date: Wed, 5 Jul 2017 22:25:11 -0700
User-agent: Alpine 2.20 (OSX 67 2015-01-07)

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.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]