Jack Kamm <jackk...@gmail.com> writes: >> Because I am still thinking about the idea with global customization and >> `org-babel-<lang>-associate-session'. > > It's great that you're thinking about this -- it would be nice to have > better consistency between ob-R, ob-python, etc, and to have better > configurability on this. In particular, ob-R's behavior to automatically > start a session is annoying for me, especially when editing on my HPC's > login node which forbids starting R, python, etc outside of slurm. > > However, the most recent version of Liu's patch is very small, and the > changes should be easy to modify in future, whatever your conclusion on > `org-babel-<lang>-associate-session'. So I would suggest not to let it > be blocked by this for too long.
I just do not want to do double work. I now reverted the obsoletion of org-babel-<lang>-associate-session. https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=99c9cae25 https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=b4687fcd6 I also fixed the problem where org-babel-<lang>-associate-session was never actually executed due to `org-src--babel-info' being set after `org-src-mode-hook'. Now, the question is what to do with the existing implementation of `org-src-associate-babel-session'. It only runs org-babel-<lang>-associate-session when (and session (not (string= session "none")) (org-babel-comint-buffer-livep session) (let ((f (intern (format "org-babel-%s-associate-session" (nth 0 info))))) (and (fboundp f) (funcall f session)))) The questionable check here is (org-babel-comint-buffer-livep session) - it only triggers when session is already initiated, while ob-python and some other backends do not necessarily need to start a new session to "associate" it with Org Src buffer. I am tentatively inclined to change this check to (or (org-babel-comint-buffer-livep session) (eq org-src-auto-initiate-session t) (alist-get (nth 0 info) org-src-auto-initiate-session) (alist-get 'default org-src-auto-initiate-session)) With `org-src-auto-initiate-session' being a customization that controls whether to associate session for a given babel backend. We may set the default value to something like ((default . t) ("R" . nil)) -- 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>