Commit 89a6d3ef authored by Troels Henriksen's avatar Troels Henriksen
Browse files

Protect the undo history, even if an error is signalled somewhere.

parent bb837646
......@@ -107,16 +107,16 @@
(let ((buffer-var (gensym)))
`(let ((,buffer-var ,buffer))
(setf (undo-accumulate ,buffer-var) '())
,@body
(cond ((null (undo-accumulate ,buffer-var)) nil)
((null (cdr (undo-accumulate ,buffer-var)))
(add-undo (car (undo-accumulate ,buffer-var))
(undo-tree ,buffer-var)))
(t
(add-undo (make-instance 'compound-record
:buffer ,buffer-var
:records (undo-accumulate ,buffer-var))
(undo-tree ,buffer-var)))))))
(unwind-protect (progn ,@body)
(cond ((null (undo-accumulate ,buffer-var)) nil)
((null (cdr (undo-accumulate ,buffer-var)))
(add-undo (car (undo-accumulate ,buffer-var))
(undo-tree ,buffer-var)))
(t
(add-undo (make-instance 'compound-record
:buffer ,buffer-var
:records (undo-accumulate ,buffer-var))
(undo-tree ,buffer-var))))))))
(defmethod flip-undo-record :around ((record climacs-undo-record))
(with-slots (buffer) record
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment