From 99660cf5e7ba3507badf357a6123e15f9a4f35c3 Mon Sep 17 00:00:00 2001 From: Takafumi Arakaki Date: Wed, 20 Jun 2012 21:01:58 +0200 Subject: [PATCH] Use ein:query-singleton-ajax everywhere --- ein-kernel.el | 12 ++++++++---- ein-notebook.el | 8 ++++++-- ein-notebooklist.el | 10 +++++++--- 3 files changed, 21 insertions(+), 9 deletions(-) diff --git a/ein-kernel.el b/ein-kernel.el index 0782bd0..30e8d6a 100644 --- a/ein-kernel.el +++ b/ein-kernel.el @@ -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 diff --git a/ein-notebook.el b/ein-notebook.el index 6b8831e..f3a558d 100644 --- a/ein-notebook.el +++ b/ein-notebook.el @@ -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")) diff --git a/ein-notebooklist.el b/ein-notebooklist.el index c2554e6..302c20b 100644 --- a/ein-notebooklist.el +++ b/ein-notebooklist.el @@ -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)