Use ein:query-singleton-ajax everywhere

This commit is contained in:
Takafumi Arakaki 2012-06-20 21:01:58 +02:00
parent 1ad0b71d6c
commit 99660cf5e7
3 changed files with 21 additions and 9 deletions

View file

@ -110,7 +110,8 @@ FIXME: document other slots."
(defun ein:kernel-start (kernel notebook-id)
"Start kernel of the notebook whose id is NOTEBOOK-ID."
(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)
(ein:$kernel-base-url kernel))
"?" (format "notebook=%s" notebook-id))
@ -125,7 +126,8 @@ FIXME: document other slots."
(ein:log 'info "Restarting kernel")
(when (ein:$kernel-running 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:$kernel-kernel-url kernel)
"restart")
@ -391,7 +393,8 @@ http://ipython.org/ipython-doc/dev/development/messaging.html#complete
(defun ein:kernel-interrupt (kernel)
(when (ein:$kernel-running 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:$kernel-kernel-url kernel)
"interrupt")
@ -403,7 +406,8 @@ http://ipython.org/ipython-doc/dev/development/messaging.html#complete
(defun ein:kernel-kill (kernel &optional callback cbargs)
(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:$kernel-kernel-url kernel))
:cache nil

View file

@ -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))
(notebook (ein:notebook-new url-or-port notebook-id)))
(ein:log 'debug "Opening notebook at %s" url)
(ein:query-ajax
(ein:query-singleton-ajax
(list 'notebook-open url-or-port notebook-id)
url
:parser #'ein:json-read
: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)
(ein:events-trigger (ein:$notebook-events 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)
:type "PUT"
:headers '(("Content-Type" . "application/json"))

View file

@ -91,7 +91,8 @@
(lambda (&rest args)
(pop-to-buffer
(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)
:cache nil
:parser #'ein:json-read
@ -146,7 +147,8 @@
(assert url-or-port nil
(concat "URL-OR-PORT is not given and the current 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)
:parser (lambda ()
(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)
(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:$notebooklist-url-or-port ein:notebooklist)
notebook-id)