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

> As long as it remains undocumented, we can break this in future (maybe
> years from now, but still...).

Fair enough, I've had to fix this feature from time to time due to
breakage in the past.

I just pushed d0d838b02 which should hopefully prevent future breakage:

https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=d0d838b02e44a40adca14d6eae39fd4c364730da

It adds a unit test for this feature, and makes the docstrings for
org-babel-python-initiate-session(-by-key) more thorough. It also
improves robustness if the source block is executed before run-python
finishes initializing.

> What might be more robust is to provide an explicit "start session
> from Org Src buffer" command for ob-python and re-bind `run-python' to
> this command in Org Src buffers.

We could refactor `org-babel-python-initiate-session-by-key' to call a
separate `org-babel-python-run-python' interactive command that wraps
`run-python', and then rebind `run-python' to it in a local minor mode
for ob-python Src buffers, which could be started in
`org-babel-edit-prep:python'.

But I'm not sure if it's worth the hassle, or if d0d838b02 already
addresses the concern sufficiently?

Note that I'd like ob-python to keep working with run-python, even if
it's invoked outside of an Org Src buffer.

Reply via email to