Jack Kamm <jackk...@gmail.com> writes:

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

Note that I proposed to remove auto-starting session completely, which
is in odds to what you propose below.

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

IMHO, it might be enough to adjust org-babel-R-associate-session as the

(defun org-babel-R-associate-session (session)
  "Associate R code buffer with an R session.
Make SESSION be the inferior ESS process associated with the
current code buffer."
  (setq ess-local-process-name
        (process-name (get-buffer-process session)))
  (when ess-local-process-name (ess-make-buffer-current))
  (setq-local ess-gen-proc-buffer-name-function (lambda (_) session)))

>From the user point of view, it should then make no difference.
If we follow the advice from

    Use ESS to step through evaluation line-by-line
      - Use C-c ' to visit the edit buffer for your code block
      - Use ess-eval-line-and-step to evaluate each line in turn

ess-eval-line-and-step should still work regardless whether ESS session
is already initiated or not before opening Org Src buffer.

Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>

Reply via email to