One of my favorite packages is undo-tree. It makes a “many branched” sequence of changes easy to fix but to tell the truth the most valuable thing about it for me is the sensible redo functionality. It’s always worked perfectly for me and is a valuable tool in my Emacs toolkit.
Oddly, though, I keep seeing tweets and blog posts about it being unreliable. Given my success with it, I didn’t pay too much attention to the reports of errors but did wonder if there was anything to them. Now the author, Toby Cubitt, has published a very informative post that addresses the purported errors and what’s really going on.
Cubitt’s problem is that he couldn’t reproduce the problems and no one could provide him with a recipe for reproducing them. There were two problems. The most common was that sometimes undo-tree would report that there were no further changes to undo even though all the changes to the buffer hadn’t been undone. Finally, someone was able to provide Cubitt with a recipe for reproducing the error and Cubitt found that there was no problem with the code—it was behaving exactly as documented—but that the real issue was “user expectations.” Emacs keeps the changes on an undo ring and when the entries are exhausted, the oldest entries are overwritten. Cubitt fixed this by increasing the default size of the ring (by a factor of 1,000) and by providing a bit more feedback to the user when data is lost.
The second problem is that occasionally the undo data would get corrupted. No one has yet been able to reproduce that error but Cubitt has an hypothesis that it’s caused by a race conditions between undo-tree and Emacs’ low level garbage collection code. He made a some changes to reduce the likelihood of this happening and made a new release.
Cubitt’s post has many more details and includes a nice explanation on how undo-tree works. If you’re an undo-tree user, it’s definitely worth reading. If you’re not an undo-tree user and have been hesitating because of its purported instability, there’s no longer any reason to hesitate. As far as I’m concerned, even if Cubitt hasn’t eradicated all of the bugs, undo-tree’s benefits are more than worth an occasional error.