mirror of
https://github.com/vale981/emacs-jupyter
synced 2025-03-04 15:41:37 -05:00
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:
parent
5d2007d5f2
commit
786f61fb99
2 changed files with 3 additions and 22 deletions
|
@ -89,7 +89,8 @@
|
||||||
(cl-defmethod jupyter-comm-start ((comm jupyter-channel-ioloop-comm))
|
(cl-defmethod jupyter-comm-start ((comm jupyter-channel-ioloop-comm))
|
||||||
(with-slots (ioloop session) comm
|
(with-slots (ioloop session) comm
|
||||||
(unless (jupyter-ioloop-alive-p ioloop)
|
(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
|
(cl-loop
|
||||||
for channel in '(:hb :shell :iopub :stdin)
|
for channel in '(:hb :shell :iopub :stdin)
|
||||||
do (jupyter-start-channel comm channel))))
|
do (jupyter-start-channel comm channel))))
|
||||||
|
|
|
@ -91,7 +91,7 @@
|
||||||
(jupyter-ioloop-add-teardown ioloop
|
(jupyter-ioloop-add-teardown ioloop
|
||||||
(mapc #'jupyter-stop-channel jupyter-channel-ioloop-channels)))
|
(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'.
|
"In the IOLOOP, set SESSION as the `jupyter-channel-ioloop-session'.
|
||||||
Add a form to IOLOOP's setup that sets the variable
|
Add a form to IOLOOP's setup that sets the variable
|
||||||
`jupyter-channel-ioloop-session' to a `jupyter-session' based on
|
`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)))
|
setup)))
|
||||||
(oref ioloop 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
|
;;; Channel events
|
||||||
|
|
||||||
(defun jupyter-channel-ioloop-add-start-channel-event (ioloop)
|
(defun jupyter-channel-ioloop-add-start-channel-event (ioloop)
|
||||||
|
|
Loading…
Add table
Reference in a new issue