Fundamental mode and undo-tree-mode
Linus Arver
linusarver at gmail.com
Sun Jan 5 07:25:15 CET 2014
On Sat, Jan 04, 2014 at 09:40:16AM +0100, Frank Fischer wrote:
> Am 04.01.2014 02:13, schrieb Linus Arver:
> > My problem is that undo-tree is loaded, but disabled when I open a file
> > with an unrecognized extension (e.g., a file named "foo",
> > but not "foo.txt").
> >
> > Again, the strange thing is that undo-tree is enabled on the *Messages*
> > buffer, but disabled (turned off) in the "foo" buffer.
>
> This is expected. Undo-tree (like Evil) is a minor-mode that is
> automatically enabled in each buffer if the corresponding "globalized
> minor mode" (namely global-undo-tree-mode) is enabled. This is realised
> by some special change-major-mode-hook and after-change-major-mode-hook
> hooks. However, if a new buffer is started in fundamental-mode these
> hooks are not run (in contrast to any other major-mode), that's why the
> local undo-tree-mode never gets a chance to be activated. The same is
> true for Evil.
>
> However, unlike undo-tree Evil adds a few additional hacks to overcome
> this problem. That's why Evil gets activated in fundamental-mode buffers
> and undo-tree does not.
>
> So if you want undo-tree to be enabled in all buffers in which Evil is
> enabled, the simplest solution is probably to do so directly:
>
> (add-hook 'evil-local-mode-hook 'turn-on-undo-tree-mode)
Thank you very much for the explanation. I just tested your line of code
and undo-tree does get enabled in new buffers.
I'm starting to think now that this should be the default Evil behavior,
as Evil requires undo-tree to function properly (i.e., it does not make
sense to have Evil enabled without undo-tree-mode, when undo-tree is
available).
-L
More information about the implementations-list
mailing list