Windows 10, Emacs 25.1, Magit

I want auto refresh buffer "magit-status" when was some change on files in my project. So I set variable magit-refresh-status-buffer to on non nil. But it not help.


You shouldn't have to set magit-refresh-status-buffer to a non-nil value because the default value already is t. (Magit only refreshes after Emacs changed a file (i.e. on save-buffer) and after it ran git for side-effects.)

It sounds like you want the status buffer to be automatically refreshed when something outside of Emacs changes a file. Magit's refresh machinery does not support that - you will have to explicitly refresh using g.

It would theoretically be possible to watch for changes and then automatically refresh the status buffer, but that would affect performance and could lead to race conditions. There actually exists a package that implements this, magit-filenotify, but I recommend against using it because it has the issues mentioned earlier and also because it wasn't updated in two years.

To automatically refresh the status buffer whenever you visit a file-visiting buffer use:

(add-hook 'after-save-hook 'magit-after-save-refresh-status t)
  • 1
    Edit file outside Emacs - autorefresh not work. Edit file in Emacs - autorefresh again NOT work. – user8542613 Oct 8 '17 at 12:32
  • For most people it works. Need more information. But before that, try without your configuration, using magit-emacs-Q-command magit.vc/manual/magit/Debugging-Tools.html. – tarsius Oct 8 '17 at 13:15
  • In minibuffer start command: M-x magit-emacs-Q-command. As result in minibuffer: Uncustomized Magit command saved to kill-ring, please run it in a terminal. – user8542613 Oct 8 '17 at 13:22
  • That's what is supposed to happen. Now follow the instructions which you can find at the url I posted above. – tarsius Oct 8 '17 at 14:57
  • OK. Maybe is it possible the next: When swith to buffer magit-status to emulate press "g" and as result in this buffer will be always actual info? – a_subscriber Nov 2 '17 at 12:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.