mirror of
https://github.com/vale981/emacs-ipython-notebook
synced 2025-03-06 01:21:38 -05:00
Use ein:query-singleton-ajax everywhere
This commit is contained in:
parent
1ad0b71d6c
commit
99660cf5e7
3 changed files with 21 additions and 9 deletions
|
@ -110,7 +110,8 @@ FIXME: document other slots."
|
||||||
(defun ein:kernel-start (kernel notebook-id)
|
(defun ein:kernel-start (kernel notebook-id)
|
||||||
"Start kernel of the notebook whose id is NOTEBOOK-ID."
|
"Start kernel of the notebook whose id is NOTEBOOK-ID."
|
||||||
(unless (ein:$kernel-running kernel)
|
(unless (ein:$kernel-running kernel)
|
||||||
(ein:query-ajax
|
(ein:query-singleton-ajax
|
||||||
|
(list 'kernel-start (ein:$kernel-kernel-id kernel))
|
||||||
(concat (ein:url (ein:$kernel-url-or-port kernel)
|
(concat (ein:url (ein:$kernel-url-or-port kernel)
|
||||||
(ein:$kernel-base-url kernel))
|
(ein:$kernel-base-url kernel))
|
||||||
"?" (format "notebook=%s" notebook-id))
|
"?" (format "notebook=%s" notebook-id))
|
||||||
|
@ -125,7 +126,8 @@ FIXME: document other slots."
|
||||||
(ein:log 'info "Restarting kernel")
|
(ein:log 'info "Restarting kernel")
|
||||||
(when (ein:$kernel-running kernel)
|
(when (ein:$kernel-running kernel)
|
||||||
(ein:kernel-stop-channels kernel)
|
(ein:kernel-stop-channels kernel)
|
||||||
(ein:query-ajax
|
(ein:query-singleton-ajax
|
||||||
|
(list 'kernel-restart (ein:$kernel-kernel-id kernel))
|
||||||
(ein:url (ein:$kernel-url-or-port kernel)
|
(ein:url (ein:$kernel-url-or-port kernel)
|
||||||
(ein:$kernel-kernel-url kernel)
|
(ein:$kernel-kernel-url kernel)
|
||||||
"restart")
|
"restart")
|
||||||
|
@ -391,7 +393,8 @@ http://ipython.org/ipython-doc/dev/development/messaging.html#complete
|
||||||
(defun ein:kernel-interrupt (kernel)
|
(defun ein:kernel-interrupt (kernel)
|
||||||
(when (ein:$kernel-running kernel)
|
(when (ein:$kernel-running kernel)
|
||||||
(ein:log 'info "Interrupting kernel")
|
(ein:log 'info "Interrupting kernel")
|
||||||
(ein:query-ajax
|
(ein:query-singleton-ajax
|
||||||
|
(list 'kernel-interrupt (ein:$kernel-kernel-id kernel))
|
||||||
(ein:url (ein:$kernel-url-or-port kernel)
|
(ein:url (ein:$kernel-url-or-port kernel)
|
||||||
(ein:$kernel-kernel-url kernel)
|
(ein:$kernel-kernel-url kernel)
|
||||||
"interrupt")
|
"interrupt")
|
||||||
|
@ -403,7 +406,8 @@ http://ipython.org/ipython-doc/dev/development/messaging.html#complete
|
||||||
|
|
||||||
(defun ein:kernel-kill (kernel &optional callback cbargs)
|
(defun ein:kernel-kill (kernel &optional callback cbargs)
|
||||||
(when (ein:$kernel-running kernel)
|
(when (ein:$kernel-running kernel)
|
||||||
(ein:query-ajax
|
(ein:query-singleton-ajax
|
||||||
|
(list 'kernel-kill (ein:$kernel-kernel-id kernel))
|
||||||
(ein:url (ein:$kernel-url-or-port kernel)
|
(ein:url (ein:$kernel-url-or-port kernel)
|
||||||
(ein:$kernel-kernel-url kernel))
|
(ein:$kernel-kernel-url kernel))
|
||||||
:cache nil
|
:cache nil
|
||||||
|
|
|
@ -285,7 +285,8 @@ See `ein:notebook-open' for more information."
|
||||||
(let ((url (ein:notebook-url-from-url-and-id url-or-port notebook-id))
|
(let ((url (ein:notebook-url-from-url-and-id url-or-port notebook-id))
|
||||||
(notebook (ein:notebook-new url-or-port notebook-id)))
|
(notebook (ein:notebook-new url-or-port notebook-id)))
|
||||||
(ein:log 'debug "Opening notebook at %s" url)
|
(ein:log 'debug "Opening notebook at %s" url)
|
||||||
(ein:query-ajax
|
(ein:query-singleton-ajax
|
||||||
|
(list 'notebook-open url-or-port notebook-id)
|
||||||
url
|
url
|
||||||
:parser #'ein:json-read
|
:parser #'ein:json-read
|
||||||
:success (cons #'ein:notebook-request-open-callback-with-callback
|
:success (cons #'ein:notebook-request-open-callback-with-callback
|
||||||
|
@ -994,7 +995,10 @@ shared output buffer. You can open the buffer by the command
|
||||||
(push `(nbformat . ,(ein:$notebook-nbformat notebook)) data)
|
(push `(nbformat . ,(ein:$notebook-nbformat notebook)) data)
|
||||||
(ein:events-trigger (ein:$notebook-events notebook)
|
(ein:events-trigger (ein:$notebook-events notebook)
|
||||||
'notebook_saving.Notebook)
|
'notebook_saving.Notebook)
|
||||||
(ein:query-ajax
|
(ein:query-singleton-ajax
|
||||||
|
(list 'notebook-save
|
||||||
|
(ein:$notebook-url-or-port notebook)
|
||||||
|
(ein:$notebook-notebook-id notebook))
|
||||||
(ein:notebook-url notebook)
|
(ein:notebook-url notebook)
|
||||||
:type "PUT"
|
:type "PUT"
|
||||||
:headers '(("Content-Type" . "application/json"))
|
:headers '(("Content-Type" . "application/json"))
|
||||||
|
|
|
@ -91,7 +91,8 @@
|
||||||
(lambda (&rest args)
|
(lambda (&rest args)
|
||||||
(pop-to-buffer
|
(pop-to-buffer
|
||||||
(apply #'ein:notebooklist-url-retrieve-callback args))))))
|
(apply #'ein:notebooklist-url-retrieve-callback args))))))
|
||||||
(ein:query-ajax
|
(ein:query-singleton-ajax
|
||||||
|
(list 'notebooklist-open url-or-port)
|
||||||
(ein:notebooklist-url url-or-port)
|
(ein:notebooklist-url url-or-port)
|
||||||
:cache nil
|
:cache nil
|
||||||
:parser #'ein:json-read
|
:parser #'ein:json-read
|
||||||
|
@ -146,7 +147,8 @@
|
||||||
(assert url-or-port nil
|
(assert url-or-port nil
|
||||||
(concat "URL-OR-PORT is not given and the current buffer "
|
(concat "URL-OR-PORT is not given and the current buffer "
|
||||||
"is not the notebook list buffer."))
|
"is not the notebook list buffer."))
|
||||||
(ein:query-ajax
|
(ein:query-singleton-ajax
|
||||||
|
(list 'notebooklist-new-notebook url-or-port)
|
||||||
(ein:notebooklist-new-url url-or-port)
|
(ein:notebooklist-new-url url-or-port)
|
||||||
:parser (lambda ()
|
:parser (lambda ()
|
||||||
(ein:notebooklist-get-data-in-body-tag "data-notebook-id"))
|
(ein:notebooklist-get-data-in-body-tag "data-notebook-id"))
|
||||||
|
@ -200,7 +202,9 @@ This value is used from `ein:notebooklist-new-scratch-notebook'."
|
||||||
|
|
||||||
(defun ein:notebooklist-delete-notebook (notebook-id name)
|
(defun ein:notebooklist-delete-notebook (notebook-id name)
|
||||||
(message "Deleting notebook %s..." name)
|
(message "Deleting notebook %s..." name)
|
||||||
(ein:query-ajax
|
(ein:query-singleton-ajax
|
||||||
|
(list 'notebooklist-delete-notebook
|
||||||
|
(ein:$notebooklist-url-or-port ein:notebooklist) notebook-id)
|
||||||
(ein:notebook-url-from-url-and-id
|
(ein:notebook-url-from-url-and-id
|
||||||
(ein:$notebooklist-url-or-port ein:notebooklist)
|
(ein:$notebooklist-url-or-port ein:notebooklist)
|
||||||
notebook-id)
|
notebook-id)
|
||||||
|
|
Loading…
Add table
Reference in a new issue