mirror of
https://github.com/vale981/emacs-ipython-notebook
synced 2025-03-05 09:01:40 -05:00
reconnect kernel if necessary under org-ctrl-c-ctrl-c
when `C-c C-c`, reconnect to kernel if it disconnected
This commit is contained in:
parent
b9f8854949
commit
dd01c4578c
3 changed files with 12 additions and 4 deletions
|
@ -291,7 +291,12 @@
|
|||
(When "^I wait for buffer to say \"\\(.+\\)\"$"
|
||||
(lambda (bogey)
|
||||
(ein:testing-wait-until
|
||||
(lambda () (s-contains? bogey (buffer-string)))
|
||||
(lambda () (ein:aif (s-contains? bogey (buffer-string)) it
|
||||
(when (with-current-buffer ein:log-all-buffer-name
|
||||
(search "WS closed unexpectedly" (buffer-string)))
|
||||
(Then "I ctrl-c-ctrl-c")
|
||||
(And "I clear log expr \"ein:log-all-buffer-name\""))
|
||||
nil))
|
||||
nil 40000 2000)))
|
||||
|
||||
(When "^I wait for cell to execute$"
|
||||
|
|
|
@ -219,7 +219,7 @@ CALLBACK of arity 1, the kernel.
|
|||
(defun ein:kernel-reconnect-session (kernel &optional callback)
|
||||
"Check if session still exists. If it does, retrieve it. If it doesn't, ask the user to create a new session (ein:kernel-retrieve-session both retrieves and creates).
|
||||
|
||||
CALLBACK with arity 0 (e.g., execute cell now that we're reconnected)"
|
||||
CALLBACK takes one argument kernel (e.g., execute cell now that we're reconnected)"
|
||||
(ein:kernel-disconnect kernel)
|
||||
(ein:kernel-session-p
|
||||
kernel
|
||||
|
@ -320,7 +320,7 @@ delete the kernel on the server side"
|
|||
(ein:aand (ein:$kernel-websocket kernel) (ein:websocket-open-p it))))
|
||||
|
||||
(defun ein:kernel-when-ready (kernel callback)
|
||||
"Execute CALLBACK of arity 0 (executing cell) when KERNEL is ready. Warn user otherwise."
|
||||
"Execute CALLBACK of arity 1 (the kernel) when KERNEL is ready. Warn user otherwise."
|
||||
(if (ein:kernel-live-p kernel)
|
||||
(funcall callback kernel)
|
||||
(ein:log 'verbose "Kernel %s unavailable" (ein:$kernel-kernel-id kernel))
|
||||
|
|
|
@ -214,7 +214,10 @@ shared output buffer. You can open the buffer by the command
|
|||
'ein:shared-output-eval-string-history)))
|
||||
(unless kernel (setq kernel (ein:get-kernel-or-error)))
|
||||
(let ((cell (ein:shared-output-get-cell)))
|
||||
(apply #'ein:cell-execute cell kernel (ein:trim-indent code) popup args)))
|
||||
(ein:kernel-when-ready
|
||||
kernel
|
||||
(lambda (ready-kernel)
|
||||
(apply #'ein:cell-execute cell ready-kernel (ein:trim-indent code) popup args)))))
|
||||
|
||||
|
||||
;;; Generic getter
|
||||
|
|
Loading…
Add table
Reference in a new issue