diff --git a/ein-notebook.el b/ein-notebook.el index cb23581..ddcec0a 100644 --- a/ein-notebook.el +++ b/ein-notebook.el @@ -307,7 +307,8 @@ the time of execution." ;; Insertion and deletion of cells (defun ein:notebook-delete-cell (notebook cell) - (let ((inhibit-read-only t)) + (let ((inhibit-read-only t) + (buffer-undo-list t)) ; disable undo recording (apply #'ewoc-delete (ein:$notebook-ewoc notebook) (ein:cell-all-element cell))) diff --git a/tests/test-ein-notebook.el b/tests/test-ein-notebook.el index 1fa9f76..2db4740 100644 --- a/tests/test-ein-notebook.el +++ b/tests/test-ein-notebook.el @@ -126,6 +126,20 @@ do (ein:notebook-delete-cell-command)) (should (equal (ein:notebook-ncells ein:notebook) 0)))) +(ert-deftest ein:notebook-delete-cell-command-no-undo () + (with-current-buffer (eintest:notebook-make-empty) + (ein:notebook-insert-cell-above-command) + (insert "some text") + (should (equal (buffer-string) " +In [ ]: +some text + +")) + (ein:notebook-kill-cell-command) + (should (equal (buffer-string) "\n")) + (should-error (undo)) ; should be ignore-error? + (should (equal (buffer-string) "\n")))) + (ert-deftest ein:notebook-kill-cell-command-simple () (with-current-buffer (eintest:notebook-make-empty) (let (ein:kill-ring ein:kill-ring-yank-pointer)