mirror of
https://github.com/vale981/emacs-ipython-notebook
synced 2025-03-06 09:31:39 -05:00
Add ein:notebooklist-new-notebook-callback
This commit is contained in:
parent
cb5f53c183
commit
7a50ae0a3a
1 changed files with 12 additions and 13 deletions
|
@ -125,21 +125,20 @@
|
||||||
(unless (setq url-or-port (ein:$notebooklist-url-or-port ein:notebooklist)))
|
(unless (setq url-or-port (ein:$notebooklist-url-or-port ein:notebooklist)))
|
||||||
(ein:query-ajax
|
(ein:query-ajax
|
||||||
(ein:notebooklist-new-url url-or-port)
|
(ein:notebooklist-new-url url-or-port)
|
||||||
:success
|
:success (cons #'ein:notebooklist-new-notebook-callback (current-buffer))
|
||||||
(cons (lambda (buffer &rest ignore)
|
|
||||||
(let ((notebook-id
|
|
||||||
(ein:notebooklist-get-data-in-body-tag "data-notebook-id")))
|
|
||||||
(message "Creating a new notebook... Done.")
|
|
||||||
(with-current-buffer buffer
|
|
||||||
(if notebook-id
|
|
||||||
(ein:notebooklist-open-notebook ein:notebooklist
|
|
||||||
notebook-id)
|
|
||||||
(message (concat "Oops. EIN failed to open new notebook. "
|
|
||||||
"Please find it in the notebook list."))
|
|
||||||
(ein:notebooklist-reload)))))
|
|
||||||
(current-buffer))
|
|
||||||
:timeout 5000))
|
:timeout 5000))
|
||||||
|
|
||||||
|
(defun ein:notebooklist-new-notebook-callback (buffer &rest ignore)
|
||||||
|
(let ((notebook-id
|
||||||
|
(ein:notebooklist-get-data-in-body-tag "data-notebook-id")))
|
||||||
|
(message "Creating a new notebook... Done.")
|
||||||
|
(with-current-buffer buffer
|
||||||
|
(if notebook-id
|
||||||
|
(ein:notebooklist-open-notebook ein:notebooklist notebook-id)
|
||||||
|
(message (concat "Oops. EIN failed to open new notebook. "
|
||||||
|
"Please find it in the notebook list."))
|
||||||
|
(ein:notebooklist-reload)))))
|
||||||
|
|
||||||
(defun ein:notebooklist-delete-notebook-ask (notebook-id name)
|
(defun ein:notebooklist-delete-notebook-ask (notebook-id name)
|
||||||
(when (y-or-n-p (format "Delete notebook %s?" name))
|
(when (y-or-n-p (format "Delete notebook %s?" name))
|
||||||
(ein:notebooklist-delete-notebook notebook-id name)))
|
(ein:notebooklist-delete-notebook notebook-id name)))
|
||||||
|
|
Loading…
Add table
Reference in a new issue