jupyter-repl-ret: Use cond

This commit is contained in:
Nathaniel Nicandro 2019-02-18 10:20:16 -06:00
parent 76315d74bd
commit 183547403d
No known key found for this signature in database
GPG key ID: C34814B309DD06B8

View file

@ -1024,8 +1024,17 @@ execute the current cell."
(when (jupyter-kernel-busy-p jupyter-current-client)
(error "Kernel busy"))
(jupyter-repl-sync-execution-state)
(if force (jupyter-send-execute-request jupyter-current-client)
(if (not jupyter-repl-use-builtin-is-complete)
(cond
(force (jupyter-send-execute-request jupyter-current-client))
(jupyter-repl-use-builtin-is-complete
(goto-char (point-max))
(let ((complete-p (equal (buffer-substring-no-properties
(line-beginning-position) (point))
"")))
(jupyter-handle-is-complete-reply
jupyter-current-client
nil (if complete-p "complete" "incomplete") "")))
(t
(let ((res (jupyter-wait-until-received :is-complete-reply
(let ((jupyter-inhibit-handlers '(:status)))
(jupyter-send-is-complete-request
@ -1033,17 +1042,11 @@ execute the current cell."
:code (jupyter-repl-cell-code)))
jupyter-repl-maximum-is-complete-timeout)))
(unless res
(message "Kernel did not respond to is-complete-request, using built-in is-complete.
(message "\
Kernel did not respond to is-complete-request, using built-in is-complete.
Reset `jupyter-repl-use-builtin-is-complete' to nil if this is only temporary.")
(setq jupyter-repl-use-builtin-is-complete t)
(jupyter-repl-ret force)))
(goto-char (point-max))
(let ((complete-p (equal (buffer-substring-no-properties
(line-beginning-position) (point))
"")))
(jupyter-handle-is-complete-reply
jupyter-current-client
nil (if complete-p "complete" "incomplete") ""))))))
(jupyter-repl-ret force)))))))
(beginning-of-buffer
;; No cells in the current buffer, just insert one
(jupyter-repl-insert-prompt 'in))))