undo

How to undo call-last-kbd-macro in emacs

In emacs, I sometimes invoke call-last-kbd-macro by mistake. When undoing I would have expected undo to undo the entire effect of the keyboard macro atomically, but that does not happen. Instead I find myself having to undo each step of the macro one at a time. How can I get emacs to return to the buffer state before the execution of the...

Implementing a robust persistent undo/redo feature

I'm writing a bitmap editor where I use the Command Pattern to represent actions that will transform the document. I keep all the commands executed so far in a list and, to implement undo, I restore the document to its initial state and then replay all but the last command. I would like my undo/redo system to have the following feature:...