Remove jupyter-session based jupyter-ioloop-start implementation

This in preparation for removing the `jupyter-ioloop-handler` method
altogether.

* jupyter-ioloop-comm.el
(jupyter-channel-ioloop--set-session): Promote to public function.
(jupyter-ioloop-start): Remove `jupyter-session` based
implementation. Preferring sub-classes to call
`jupyter-channel-ioloop-set-session`.

* jupyter-channel-ioloop-comm.el
(jupyter-comm-initialize): Use the newly public function.
This commit is contained in:
Nathaniel Nicandro 2020-04-17 13:05:17 -05:00
parent 5d2007d5f2
commit 786f61fb99
2 changed files with 3 additions and 22 deletions

View file

@ -89,7 +89,8 @@
(cl-defmethod jupyter-comm-start ((comm jupyter-channel-ioloop-comm))
(with-slots (ioloop session) comm
(unless (jupyter-ioloop-alive-p ioloop)
(jupyter-ioloop-start ioloop session comm))
(jupyter-channel-ioloop-set-session ioloop (oref comm session))
(cl-call-next-method))
(cl-loop
for channel in '(:hb :shell :iopub :stdin)
do (jupyter-start-channel comm channel))))

View file

@ -91,7 +91,7 @@
(jupyter-ioloop-add-teardown ioloop
(mapc #'jupyter-stop-channel jupyter-channel-ioloop-channels)))
(defun jupyter-channel-ioloop--set-session (ioloop session)
(defun jupyter-channel-ioloop-set-session (ioloop session)
"In the IOLOOP, set SESSION as the `jupyter-channel-ioloop-session'.
Add a form to IOLOOP's setup that sets the variable
`jupyter-channel-ioloop-session' to a `jupyter-session' based on
@ -108,26 +108,6 @@ sets `jupyter-channel-ioloop-session' via `setq' before doing so."
setup)))
(oref ioloop setup)))
(cl-defmethod jupyter-ioloop-start ((ioloop jupyter-channel-ioloop)
(session jupyter-session)
obj &key buffer)
"Start IOLOOP, using SESSION to set the `jupyter-channel-ioloop-session'.
Add setup forms to IOLOOP that will initialize the
`jupyter-channel-ioloop-session' variable to a `jupyter-session'
based on SESSION's id and key. Also add
`jupyter-ioloop-recv-messages' to `jupyter-ioloop-post-hook'. In
addition add the events send, start-channel, and stop-channel
that the parent Emacs process can send to the IOLOOP. See
`jupyter-channel-ioloop-add-send-event',
`jupyter-channel-ioloop-add-start-channel-event', and
`jupyter-ioloop-add-stop-channel-event'.
After doing the above initialization, start the IOLOOP. OBJ and
BUFFER have the same meaning as in the method definition for
`jupyter-ioloop'."
(jupyter-channel-ioloop--set-session ioloop session)
(cl-call-next-method ioloop obj :buffer buffer))
;;; Channel events
(defun jupyter-channel-ioloop-add-start-channel-event (ioloop)