jupyter
jupyter copied to clipboard
Is there a hook that's being called when the kernel returns from evaluating a cell?
I've found jupyter-repl-cell-post-send-hook for the begining of evaluation, and jupyter-add-hook, but I'm not sure if that runs when I think it does, nor what values CLIENT will accept..
Thanks!
There are the jupyter-shell-message-hook and the like.
You can use them like so
(defun nn/on-execute-reply (client msg)
(when (equal (jupyter-message-type msg) "execute_reply")
(let ((req
;; The actual `jupyter-request' object associated with the
;; message. You can access all the messages associated
;; with the request using `jupyter-request-messages'.
(plist-get msg :parent-request)))
;; Do something
)))
(jupyter-add-hook client 'jupyter-shell-message-hook #'nn/on-execute-reply)
You can add to jupyter-shell-message-hook (the global value) using just add-hook to do something for every client.