mirror of
https://github.com/vale981/emacs-jupyter
synced 2025-03-05 23:41:38 -05:00
Add jupyter-include-other-output
This commit is contained in:
parent
10f8115b8e
commit
5f8717981b
1 changed files with 14 additions and 7 deletions
|
@ -32,6 +32,19 @@
|
||||||
(require 'jupyter-channels)
|
(require 'jupyter-channels)
|
||||||
(require 'jupyter-messages)
|
(require 'jupyter-messages)
|
||||||
(eval-when-compile (require 'cl))
|
(eval-when-compile (require 'cl))
|
||||||
|
(defcustom jupyter-include-other-output nil
|
||||||
|
"Whether or not to handle messages not sent by a client.
|
||||||
|
A Jupyter client can receive messages from other clients
|
||||||
|
connected to the same kernel on the IOPub channel. You can choose
|
||||||
|
to ignore these messages by setting
|
||||||
|
`jupyter-include-other-output' to nil. If
|
||||||
|
`jupyter-include-other-output' is non-nil, then any messages that
|
||||||
|
are not associated with a request from a client are sent to the
|
||||||
|
client's handler methods with a nil value for the request
|
||||||
|
argument. To change the value of this variable for a particular
|
||||||
|
client use `jupyter-set'."
|
||||||
|
:group 'jupyter
|
||||||
|
:type 'boolean)
|
||||||
|
|
||||||
(defvar jupyter--debug nil
|
(defvar jupyter--debug nil
|
||||||
"Set to non-nil to emit sent and received messages to *Messages*.")
|
"Set to non-nil to emit sent and received messages to *Messages*.")
|
||||||
|
@ -708,13 +721,7 @@ are taken:
|
||||||
(pmsg-id (jupyter-message-parent-id msg))
|
(pmsg-id (jupyter-message-parent-id msg))
|
||||||
(requests (oref client requests))
|
(requests (oref client requests))
|
||||||
(req (gethash pmsg-id requests)))
|
(req (gethash pmsg-id requests)))
|
||||||
(if (not req)
|
(when (or req jupyter-include-other-output)
|
||||||
;; Always run handlers of IOPub messages, even when they are not
|
|
||||||
;; associated with any request that was sent by us.
|
|
||||||
;;
|
|
||||||
;; TODO: Would we always want this?
|
|
||||||
(when (eq (oref channel type) :iopub)
|
|
||||||
(jupyter-handle-message channel client nil msg))
|
|
||||||
(setf (jupyter-request-last-message-time req) (current-time))
|
(setf (jupyter-request-last-message-time req) (current-time))
|
||||||
(unwind-protect
|
(unwind-protect
|
||||||
(jupyter--run-callbacks req msg)
|
(jupyter--run-callbacks req msg)
|
||||||
|
|
Loading…
Add table
Reference in a new issue