jupyter
jupyter copied to clipboard
Debug jupyter communication on inserting new line in Org mode source blocks
With the workaround described in https://github.com/nnicandro/emacs-jupyter/issues/398 a remaining performance impact is noticed on inserting a new line in Org mode source blocks. From what I can see in htop at least 2 ipython processes are spawned and then another one with an importmagicserver.py.
It seems odd to me that on inserting a new line emacs-jupyter starts new ipython processes. What am I missing? Any way to debug the communication to see why those processes get started?
I never profiled my fix in #398, but I also never saw a reason this should have any performance impact. Are you sure these processes are spawned because of that workaround? I've run this fix for months, and didn't notice any subjective performance impact.
I didn't think the issue had anything to do with emacs-jupyter in the first place, but rather the way in-region completion worked with some interfaces to completion (selectrum/vertico in my case). Then again, I mostly use emacs-jupyter with python kernels, so that's where I would see potential bugs happening.
To be clear, the performance hit in my OP in #398 was decreased by your fix. This issue is about the remaining performance hit. Sorry for not being clear and mentioning #398 in that way. I just thought to mention it in case it mattered. If it were directly about your fix, I would have continued discussion directly in #398.
Then again, I mostly use emacs-jupyter with python kernels, so that's where I would see potential bugs happening.
Same here.
I didn't think the issue had anything to do with emacs-jupyter in the first place
My reasoning is that emacs-jupyter controls the ipython communication and process interaction in Org mode source blocks. I definitely see the mentioned processes spawned directly and in a repeatable way when I insert a new line in the Org mode source block.
I see the described behavior when inserting newlines with RET (org-open-at-point). If I use C-j (org-return-and-maybe-indent) instead I do not see the mentioned delay.
Something to do with hooks maybe? Also, as I am using evil mode with Spacemacs, the same delay happens with o (evil-org-open-below) or O (evil-org-open-above).
Also, because you mentioned mostly using emacs-jupyter for Python, and for completeness, these are the messages I see in the minibuffer during the delay and process spawning:
Can’t guess python-indent-offset, using defaults: 4
Importmagic and/or epc not found. importmagic.el will not be working.