Undo is broken almost everywhere
It really is. Forget everything you know about software. When was the first time you used one? You probably took the mouse or the keyboard and were amazed by how the machine obeyed to your most incredible wishes. Want to move the mouse to the upper right? Zooooom! Want to open a directory? Click! And when you learned about undo! Oh I remember! It was almost the best feature of a computer. You know when you draw or paint something, you need to know where to stop, otherwise you may end up ruining your chef d’oeuvre. No more with a computer! Want to try a little tree in this corner? Go on! You can UNDO!
But wait, what if I want to redo? So let’s say you undo 3 times, change a word, then realize you shouldn’t have changed it in the first place. The horror! For most software, when you make any action after an undo, it’s goodbye data! But why? For any new computer user, this is surprising. “So you mean I can access X number of previous states, but only if I don’t undo something? Then my history will have gaps in it?” If you follow the principle of least astonishment1, this is bad! Really really bad! Most users now try to patch this horrible design by saving more often. How often did you do this yourself? “Oh I want to try X, I should save now so I could come back to this state later.” No! Nononono! Computers are tools! They should do what you want and what you expect!
Undoing the undo
For Emacs, undo is like any other action. Now think about it. If you can undo an action, then you can also undo an undo. You could also undo the undo of an undo. This quickly becomes confusing, in particular when you throw some changes in the middle of all this. This is confusing, but very, very powerful. Keep in mind that Emacs now has the history of every action you’ve made. Want to return to a previous state? Turn back the time machine…
Back to the future
Here is where Emacs really shines. When you undo X number of times and make a change, you can still return to any previous states, even those forbidden by all the other ill designed softwares. See it as alternate timelines. Each time you make a different action at the same “time”, you create an alternate history. Don’t like the result? Jump back in your Delorean… eh I mean Emacs… and go to your favorite branch. There’s a terrific mode for using this abstraction: Undo Tree. In addition, you can save all your undos and load them back when you open the file again. How wonderful is that!?! Here is a little Undo Tree from the redaction of this very article.
This is why Emacs seems weird when you first use it: because it behaves like you expect it to!