more bad undo bug

printed output also doesn't properly set the buffer
before disabling `buffer-undo-list`
This commit is contained in:
dickmao 2019-11-08 21:06:15 -05:00
parent 922c5b6bec
commit 5e9c30e170
2 changed files with 24 additions and 23 deletions

View file

@ -838,20 +838,21 @@ If END is non-`nil', return the location of next element."
;; (ein:flush-clear-timeout)
(setf (slot-value cell 'outputs)
(append (slot-value cell 'outputs) (list json)))
;; enter last output element
(let* ((inhibit-read-only t)
(buffer-undo-list t) ; disable undo recording
(ewoc (slot-value cell 'ewoc))
(index (1- (ein:cell-num-outputs cell)))
(path `(cell output ,index))
(class (ein:cell-output-json-to-class json))
(data (ein:node-new path cell class))
(last-node (ein:cell-element-get cell :last-output))
(ewoc-node (ewoc-enter-after ewoc last-node data))
(element (slot-value cell 'element)))
(plist-put element :output
(append (plist-get element :output) (list ewoc-node)))
(ewoc-invalidate ewoc (ein:cell-element-get cell :footer))))
(with-current-buffer (ewoc-buffer (slot-value cell 'ewoc))
(let* ((inhibit-read-only t)
(buffer-undo-list t) ; disable undo recording
(ewoc (slot-value cell 'ewoc))
(index (1- (ein:cell-num-outputs cell)))
(path `(cell output ,index))
(class (ein:cell-output-json-to-class json))
(data (ein:node-new path cell class))
(last-node (ein:cell-element-get cell :last-output))
(ewoc-node (ewoc-enter-after ewoc last-node data))
(element (slot-value cell 'element)))
(plist-put element :output
(append (plist-get element :output) (list ewoc-node)))
(ewoc-invalidate ewoc (ein:cell-element-get cell :footer)))))
(cl-defmethod ein:cell-append-pyout ((cell ein:codecell) json)
"Insert pyout type output in the buffer.

View file

@ -1056,8 +1056,8 @@ Do not clear input prompts when the prefix argument is given."
:cell-p #'ein:codecell-p)))
(ein:kernel-when-ready (slot-value ws 'kernel)
(apply-partially
(lambda (ws* cell* buffer* kernel)
(with-current-buffer buffer*
(lambda (ws* cell* buffer kernel)
(with-current-buffer buffer
(let ((buffer-undo-list t))
(ein:cell-execute cell*)
(oset ws* :dirty t))
@ -1272,14 +1272,14 @@ function."
(ein:with-live-buffer (ein:worksheet-buffer ws)
(ein:kernel-when-ready
(slot-value ws 'kernel)
(apply-partially
(lambda (ws kernel)
(let ((buffer-undo-list t))
(mapc #'ein:cell-execute
(seq-filter #'ein:cell-autoexec-p
(ein:worksheet-get-cells ws)))))
ws))))
(lambda (ws buffer kernel)
(with-current-buffer buffer
(let ((buffer-undo-list t))
(mapc #'ein:cell-execute
(seq-filter #'ein:cell-autoexec-p
(ein:worksheet-get-cells ws))))))
ws (current-buffer)))))
;;; Imenu