Toggling evil-local-mode off when updating buffers with magit

Frank Fischer frank.fischer at mathematik.tu-chemnitz.de
Fri Nov 18 13:12:47 CET 2011


On Fri, Nov 18, 2011 at 12:29:53PM +0100, Nikolai Weibull wrote:
> On Fri, Nov 18, 2011 at 11:20, Frank Fischer
> <frank.fischer at mathematik.tu-chemnitz.de> wrote:
> > On Fri, Nov 18, 2011 at 09:47:35AM +0100, Nikolai Weibull wrote:
> >> Running ‹make terminal› works and after saying no to running the tests
> >> (running the tests gives the same result) I run the following:
> >>
> >> C-x C-f evil-ex.el C-m M-: (revert-buffer t t nil) C-m
> >>
> >> resulting in
> >>
> >> Toggling evil-local-mode off; better pass an explicit argument.
> >> t
> >
> > But does it disable evil? Here evil is immediately enabled again (as
> > it should be).
> 
> Doh.  Sorry, that was absolutely stupid of me.   I just saw the
> toggling message and figured that it was off.
> 
> OK, here’s a way that works:
> 
> cd evil-git-dir
> emacs -nw -Q -L . -l evil.el --eval "(evil-mode 1)"
> C-x C-f a i a <Esc> C-x C-s M-: (revert-buffer t t nil) C-m
> 
> The buffer a should be in Fundamental mode.  You can also use M-x
> revert-buffer to get the same result.

This explains the problem. Fundamental mode does not run any hooks,
therefore evil can't be enabled again. Evil does several tricks in
order to ensure that evil is enabled in fundamental-mode buffers when
they are created, but functions like revert-buffer are not handled.
This is probably not so easy to fix (one could advise revert-buffer,
but there may be other functions ...)

> For some reason Evil-Local is restored if you do this for, for
> example, evil-ex.el, but not for a.
> 
> I tried the same by creating a buffer called a.rb, which starts in
> Ruby mode.  This gave the same behavior as for evil-ex.el.  I’ve had
> this problem with Ruby files, so it shouldn’t depend on that.

If the buffer is not in fundamental-mode there must be a different
problem. Any example for buffers that are not in fundamental-mode?

Frank



More information about the implementations-list mailing list