Ihor Radchenko <yanta...@posteo.net> writes:

> So, a good option could be
> (1) removing (org-babel-comint-buffer-livep session) from
>     `org-src-associate-babel-session'
> (2) Removing `org-babel-edit-prep:R'
>
> With the above, we can use `org-babel-python-associate-session'

Sounds good to me.

> I imagine that both #1 and #2 should happen in
> org-babel-<lang>-associate-session. #1 should probably be discouraged,
> and it looks like even for ob-R creating new session is not really
> necessary.

It looks like ob-R and ob-julia are the only languages that start
sessions on edit (based on grepping for "edit-prep" and
"associate-session").

I think their behavior is peculiar enough to have an ob-R/julia-specific
option on whether to initiate session on edit, with options nil, t, and
earmuffs. Earmuffs is the current behavior, but it's surprising enough
(IMO) that it might be worth changing the default to nil or t. But still
worth keeping the earmuffs option since this behavior seems to go back
to the original implementation (30931bfe1). If it helps, I can prepare a
patch for this after you've made the changes for
org-babel-<lang>-associate-session.

In my notebooks I generally define my ob-R sessions to have earmuffs
(like ":session *R:project-name*") so that they can easily work with
"M-x R" (which names sessions as such by default). Until now I did not
realize this was the culprit for the annoying (and undocumented) startup
behavior I was experiencing.

Reply via email to