mirror of
https://github.com/vale981/emacs-ipython-notebook
synced 2025-03-06 09:31:39 -05:00
Make cells in ein:worksheet-from-json
This is needed to make ein:worksheet-to-json work with un-rendered worksheets.
This commit is contained in:
parent
fb0ea65943
commit
e03f8861b6
1 changed files with 8 additions and 5 deletions
|
@ -83,7 +83,7 @@ this value."
|
|||
;; removed later. This is here only for backward compatible
|
||||
;; reason.
|
||||
(discard-output-p :initarg :discard-output-p)
|
||||
(data :initarg :data)
|
||||
(saved-cells :initarg :saved-cells :initform nil)
|
||||
(ewoc :initarg :ewoc :type ewoc)
|
||||
(kernel :initarg :kernel :type ein:$kernel)
|
||||
(dirty :initarg :dirty :type boolean :initform nil)
|
||||
|
@ -183,11 +183,12 @@ this value."
|
|||
(let ((ewoc (ein:ewoc-create 'ein:worksheet-pp
|
||||
(ein:propertize-read-only "\n")
|
||||
nil t))
|
||||
(cells (plist-get (oref ws :data) :cells)))
|
||||
(cells (oref ws :saved-cells)))
|
||||
(oset ws :ewoc ewoc)
|
||||
(if cells
|
||||
(mapc (lambda (data)
|
||||
(ein:cell-enter-last (ein:cell-from-json data :ewoc ewoc)))
|
||||
(mapc (lambda (c)
|
||||
(oset c :ewoc ewoc)
|
||||
(ein:cell-enter-last c))
|
||||
cells)
|
||||
(ein:worksheet-insert-cell-below ws 'code nil t))))
|
||||
(set-buffer-modified-p nil)
|
||||
|
@ -208,7 +209,9 @@ this value."
|
|||
;;; Persistance and loading
|
||||
|
||||
(defmethod ein:worksheet-from-json ((ws ein:worksheet) data)
|
||||
(oset ws :data data)
|
||||
(destructuring-bind (&key cells metadata &allow-other-keys) data
|
||||
(oset ws :saved-cells
|
||||
(mapcar (lambda (data) (ein:cell-from-json data)) cells)))
|
||||
ws)
|
||||
|
||||
(defmethod ein:worksheet-to-json ((ws ein:worksheet))
|
||||
|
|
Loading…
Add table
Reference in a new issue