File tree Expand file tree Collapse file tree 2 files changed +20
-3
lines changed Expand file tree Collapse file tree 2 files changed +20
-3
lines changed Original file line number Diff line number Diff line change @@ -117,7 +117,11 @@ from the kernel.")
117117 " MIME types that can be used in terminal Emacs." )
118118
119119(defvar jupyter--debug nil
120- " When non-nil, some parts of Jupyter will emit debug statements." )
120+ " When non-nil, some parts of Jupyter will emit debug statements.
121+ If the symbol 'message, messages received by a kernel will only
122+ be handled by clients when the function
123+ `jupyter--debug-run-message-queue' is called manually. This
124+ allows for stepping through the code with Edebug." )
121125
122126
123127(defvar jupyter-default-timeout 2.5
Original file line number Diff line number Diff line change @@ -586,12 +586,25 @@ back."
586586 (when jupyter--debug
587587 (jupyter--show-event event)))
588588
589+ (defvar jupyter--debug-message-queue nil )
590+
589591(cl-defmethod jupyter-event-handler ((client jupyter-kernel-client)
590592 (event (head message)))
591593 (when jupyter--debug
592594 (jupyter--show-event event))
593- (cl-destructuring-bind (_ channel _idents . msg) event
594- (jupyter-handle-message client channel msg)))
595+ (if (eq jupyter--debug 'message )
596+ (push
597+ (cl-destructuring-bind (_ channel _idents . msg) event
598+ (lambda ()
599+ (jupyter-handle-message client channel msg)))
600+ jupyter--debug-message-queue)
601+ (cl-destructuring-bind (_ channel _idents . msg) event
602+ (jupyter-handle-message client channel msg))))
603+
604+ (defun jupyter--debug-run-message-queue ()
605+ (let ((queue (reverse jupyter--debug-message-queue)))
606+ (setq jupyter--debug-message-queue nil )
607+ (cl-loop for thunk in queue do (funcall thunk))))
595608
596609; ;; Starting communication with a kernel
597610
You can’t perform that action at this time.
0 commit comments