From 786f61fb990082827be3f700637655cda90c3836 Mon Sep 17 00:00:00 2001 From: Nathaniel Nicandro Date: Fri, 17 Apr 2020 13:05:17 -0500 Subject: [PATCH] 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. --- jupyter-channel-ioloop-comm.el | 3 ++- jupyter-channel-ioloop.el | 22 +--------------------- 2 files changed, 3 insertions(+), 22 deletions(-) diff --git a/jupyter-channel-ioloop-comm.el b/jupyter-channel-ioloop-comm.el index e47906b..28d4ba8 100644 --- a/jupyter-channel-ioloop-comm.el +++ b/jupyter-channel-ioloop-comm.el @@ -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)))) diff --git a/jupyter-channel-ioloop.el b/jupyter-channel-ioloop.el index b324c9c..fff4453 100644 --- a/jupyter-channel-ioloop.el +++ b/jupyter-channel-ioloop.el @@ -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)