Disable flymake when reverting buffers (e.g. after checkout) #417

jplindstrom opened this Issue May 23, 2012 · 5 comments


None yet

4 participants


I have flymake enabled, and if I have many buffers opened when I e.g. change branch that spams the machine with a bunch of flymake processes, hogging the machine for several, possibly tens of seconds.

It seems reasonable to avoid running flymake during revert to avoid this, the assumption being that an instant checkout is more useful than flymaking something that's likely to be ok.
(As a bonus option, maybe only flymake buffers in visible frames)

This could be a magit config setting, magit-disable-flymake-during-revert (default: t)
If flymake isn't loaded or enabled, this should be a no-op.

I've created a hard coded proof-of-concept just to see if it was feasible, and it made a huge change: jplindstrom@1836771

Is this something that people would like to see in Magit?

sigma commented May 24, 2012

There are several aspects to this issue.

First, I guess this is primarily a flymake issue, as it should probably avoid storming an uncontrolled number of processes, whatever the reason. A hack at magit level would definitely not solve the general issue: for example, switching branches from git command line would trigger the exact same effect.

Also, I'm more than reluctant introducing references to flymake in magit core.
But maybe there's value in introducing hooks for magit-revert-buffers, that would allow you to register such hacks yourself, if you like them.

Not referencing external libs in Magit core is a good point.
But what does "core" mean in this case? is it magit.el, or the magit distro as a whole?

Would it be ok, with the new hooks in place, to bundle a new file magit-flymake.el that people can require to enable this functionality?

sigma commented May 24, 2012

I guess we could include such a file in the contrib/ directory.
Or, if the hooks are really trivial, maybe simply mention them as examples in the documentation

Based on the diff, shouldn't this be done with some simple advice (and not in magit)?

(defadvice magit-revert-buffers (around magit-disable-flymake-during-revert)
  (setq flymake-start-syntax-check-on-find-file nil)
  (setq flymake-start-syntax-check-on-find-file t))
(ad-activate 'magit-revert-buffers)
tarsius commented May 26, 2013

Closing since the Op did not follow up. As sigma said we could add the appropriate hooks where needed and we might even bundle a magit-flymake.el, if someone wrote it. But I also agree with sigma that this is mostly a flymake problem. Meanwhile the above advice can be used.

@tarsius tarsius closed this May 26, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment