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’.
"... 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."
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.
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.