mirror of
https://github.com/vale981/emacs-jupyter
synced 2025-03-05 07:41:37 -05:00
Move jupyter-eval
from jupyter-repl.el
to jupyter-client.el
This commit is contained in:
parent
ab44407fdf
commit
ecd6a3098b
2 changed files with 16 additions and 15 deletions
|
@ -1019,6 +1019,22 @@ the user. Otherwise `read-from-minibuffer' is used."
|
|||
implementation_version language_info
|
||||
banner help_links)))))
|
||||
|
||||
;;; Evaluation
|
||||
|
||||
(defun jupyter-eval (code &optional mime)
|
||||
"Send an execute request for CODE, wait for the execute result.
|
||||
The `jupyter-current-client' is used to send the execute request.
|
||||
All client handlers except the status handler are inhibited for
|
||||
the request. In addition, the history of the request is not
|
||||
stored. Return the MIME representation of the result. If MIME is
|
||||
nil, return the text/plain representation."
|
||||
(let ((msg (jupyter-wait-until-received :execute-result
|
||||
(let ((jupyter-inhibit-handlers '(not :status)))
|
||||
(jupyter-send-execute-request jupyter-current-client
|
||||
:code code :store-history nil)))))
|
||||
(when msg
|
||||
(jupyter-message-data msg (or mime :text/plain)))))
|
||||
|
||||
(cl-defgeneric jupyter-send-execute-request ((client jupyter-kernel-client)
|
||||
&key code
|
||||
(silent nil)
|
||||
|
|
|
@ -2132,21 +2132,6 @@ DETAIL is the detail level to use for the request and defaults to
|
|||
read-expression-map
|
||||
nil 'jupyter-repl-eval-expression-history)))))
|
||||
|
||||
;; Simple eval
|
||||
(defun jupyter-eval (code &optional mime)
|
||||
"Send an execute request for CODE, wait for the execute result.
|
||||
The `jupyter-current-client' is used to send the execute request.
|
||||
All client handlers except the status handler are inhibited for
|
||||
the request. In addition, the history of the request is not
|
||||
stored. Return the MIME representation of the result. If MIME is
|
||||
nil, return the text/plain representation."
|
||||
(let ((msg (jupyter-wait-until-received :execute-result
|
||||
(let ((jupyter-inhibit-handlers '(not :status)))
|
||||
(jupyter-send-execute-request jupyter-current-client
|
||||
:code code :store-history nil)))))
|
||||
(when msg
|
||||
(jupyter-message-data msg (or mime :text/plain)))))
|
||||
|
||||
(defun jupyter-repl-eval-string (str &optional silently cb)
|
||||
"Evaluate STR with the `jupyter-current-client's REPL.
|
||||
Replaces the contents of the last cell in the REPL buffer with
|
||||
|
|
Loading…
Add table
Reference in a new issue