Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is there a hook that's being called when the kernel returns from evaluating a cell? #544

Open
JonatanSahar opened this issue Jun 30, 2024 · 1 comment

Comments

@JonatanSahar
Copy link

JonatanSahar commented Jun 30, 2024

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!

@nnicandro
Copy link
Collaborator

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants