Emacs: Undo Tree package

8 August 2013 Emacs has a powerful undo system. Unlike the standard undo/redo system in most software, it allows you to recover any past state of a buffer (whereas the standard undo/redo system can lose past states as soon as you redo). However, this power comes at a price: many people find Emacs' undo system confusing and difficult to use, spawning a number of packages that replace it with the less powerful but more intuitive undo/redo system. (See the Emacs Wiki.)

Both the loss of data with standard undo/redo, and the confusion of Emacs' undo, stem from trying to treat undo history as a linear sequence of changes. It's not. The undo-tree-mode provided by this package replaces Emacs' undo system with a system that treats undo history as what it is: a branching tree of changes. This simple idea allows the more intuitive behaviour of the standard undo/redo system to be combined with the power of never losing any history. An added side bonus is that undo history can in some cases be stored more efficiently, allowing more changes to accumulate before Emacs starts discarding history.

It gets better. You don't have to imagine the undo tree, because undo-tree-mode includes an undo-tree visualizer which draws it for you, and lets you browse around the undo history.

The only downside to this more advanced yet simpler undo system is that it was inspired by Vim. But, after all, most successful religions steal the best ideas from their competitors!


Details of the undo-tree-mode commands and key bindings can be found in the Commentary section at the top of the undo-tree.el file itself, along with an extended explanation (with diagrams!) of the differences between the undo-tree-mode, standard Emacs' undo, and undo/redo systems.

The commands themselves are all documented using the standard, built-in Emacs documentation features. Customization options can be found under the undo-tree customization group.

Download and Installation

In recent versions of Emacs (>=24.1), you can install the Undo-Tree package from within Emacs itself, via GNU ELPA. Use M-x list-packages and take it from there. This is the preferred installation method. (Occasionally, the ELPA version might lag slightly behind the latest version available here.)

The current "stable" release of the Undo-Tree package is version 0.6.6 (released August 2013). It's relatively stable, though bug fixes and new features are added occasionally. (A few older versions are also available below, but are no longer supported.)

If you want to live on the bleeding edge, the latest "development" version of the Undo-Tree package is hosted in a git repository.

Note that the git repository URL is a git repository, not a web-site. You cannot view it in a web browser. To grab the latest development version, clone the repository using something like:

git clone http://www.dr-qubit.org/git/undo-tree.git

Unless you obtained Undo-Tree from ELPA (which takes care of package installation for you), to install the Undo-Tree package, simply save the undo-tree.el file to a directory in your Emacs load-path, and add the line:

(require 'undo-tree)

to your .emacs file. M-x undo-tree-mode will then enable undo-tree-mode in the current buffer.

If you want to replace the standard Emacs' undo system with the Undo-Tree system in all normal buffers, you can enable undo-tree-mode globally by adding:


to your .emacs file.

Bugs, Feature Requests, and Contributing

Bugs, feature requests, and any other feedback should be addressed to toby-undo-tree@dr-qubit.org. (Note that this address is protected by the TMDA spam-reduction system. The first time you send an email, you will have to verify your address by replying to a confirmation message.)

If you have code you would like to contribute to Undo-Tree, either send a patch against the latest development version to toby-undo-tree@dr-qubit.org. Or, better still, use git, rebase your work against the latest git master, and let me know where to find your clone of the Undo-Tree repository so that I can pull your changes.

I maintain Undo-Tree in my spare time, which is in very short supply these days! So I tend to batch-process bug reports, feature requests and patches at intervals of a year or more. So if you contact me about Undo-Tree and don't receive a response, it's not because I'm ignoring you or didn't received your email. You're just in a queue of indeterminate length until the next undo-tree batch job runs. It does run eventually, though.

There are numerous comments on the internet about seeing the message "No further undo information" and losing all undo history. Unfortunately, so far I've never encountered this issue myself, despite using global-undo-tree-mode. And no one has yet sent me a recipe that allows me to successfully reproduce it. If you have steps for reliably reproducing this bug in vanilla Emacs + undo-tree, please let me know! I'm very interested in finally tracking this one down.



16 June 2016 Cool, this package is the most excited package i ever used in emacs for servel years.


16 June 2016 Thanks a lot if author could move this package to github.

there will exist more collaborator and contributer to enhance this package a lot.


17 April 2017 Hi Toby,

I like what I have seen from you and on this page. I'll try out undo-tree now.

One remark, the latest version in Git is already 0.6.6. It would be great if you kept this web page and the download URL updated, because this page is the main information source for this package.

Cheers, Martin


30 January 2019 Two questions:

  1. Are you in the loop as to why is the debian package seemingly so out of date? apt policy reports their version as 6.4.
  2. Now in 2019, is the git HEAD a stable improvement over the 6.6?

Toby Cubitt

12 February 2019 @Boruch #4:

  1. No clue why the Debian package is so old. But undo-tree has been available through GNU Elpa for ages now. I'd recommend installing it from there, rather than the distro package.
  2. The two changes sitting in git after the 6.6 release are so trivial, it hasn't seemed worth rolling a new release.


13 March 2019 Hi, I'm having quite some undo related issues which seem related to undo-tree. I'm using Spacemacs with vim keybindings. In a random fashion, the buffers lose undo information, so when I press "u" I get the dreaded "No further undo information." message.

Do you have any clue on what can cause this malfunctioning? Some hints on how to debug this issue would also be appreciated.


18 April 2019 Hi Dr. Cubitt,

I believe undo-tree is no longer on MELPA. It is on ELPA, but the most recent release is 0.6.5. Some have upgraded via git/QUELPA to 0.6.6 in hopes that it would fix the "No further undo information" bug, but it doesn't appear to.

[https://github.com/syl20bnr/spacemacs/issues/12110] [https://github.com/syl20bnr/spacemacs/issues/9903#issuecomment-480567185]

If there is anything of note in 0.6.6 and you have the time and ability to publish those changes to ELPA, that'd be great. Thank you!


14 June 2019 I frequently get corrupted nodes in the tree. Sometimes, I even get garbled text when undoing. I cannot quite pin down the reason, but is there a way to troubleshoot these problems when they happen?

Toby Cubitt

17 June 2019 @Alessandro #6, @Aaron #7, @Abdo #8:

I've been hearing about this issue for a long time now. Unfortunately, so far I've never encountered this issue myself, despite using global-undo-tree-mode. And no one has yet sent me a recipe that allows me to successfully reproduce it. Most (all?) of the reports seem to be from people using Spacemacs, so I wonder if the issue is to do with how undo-tree is integrated into Spacemacs, rather than the undo-tree package per se?

Until someone sends me steps to reliably reproduce this in vanilla Emacs + undo-tree, or I encounter this issue myself, it's extremely hard for me to investigate it.

There are only trivial changes in version 0.6.6, nothing that would fix this issue.

Leave a comment

All comments are moderated. By submitting your comment you agree to license the content under a Creative Commons Attribution-ShareAlike 4.0 International License.

Creative Commons License