Allow no undo after deleting a cell

This commit is contained in:
Takafumi Arakaki 2012-05-25 17:57:52 +02:00
parent 98ae4efbb9
commit e5a4e8a229
2 changed files with 16 additions and 1 deletions

View file

@ -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)))

View file

@ -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)