Skip to content

ruediger/magit-filenotify

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

40 Commits
 
 
 
 
 
 

Repository files navigation

Refresh status buffer when git tree changes

This extension to Magit provides a minor-mode which, when enabled, automatically updates a repository’s status buffer whenever a file inside that repository’s working tree has changed. It uses the file notification support that was added in Emacs v24.4.

Should I use it?

Note that Magit itself refreshes the appropriate status buffer whenever you run a Magit command. (Before v2.3, Magit did only do so when the major-mode of the current buffer derives from magit-mode, but now it does so whenever you run a Magit command, regardless of context.)

Additionally, also starting with v2.3, Magit can be configured to also refresh a repository’s status buffer whenever you save a buffer which visits a file which is being tracked in that repository. Due to performance concerns that feature is not enabled by default, to enable it add this to your init file:

(add-hook 'after-save-hook 'magit-after-save-refresh-status)

After you have done that and assuming that you mostly interact with Git using Magit, then you don’t need this package. If a status buffer is out-of-date due to outside changes, you can always refresh it by simply pressing g.

You can find more information about how Magit automatically refreshes buffers and about how to do it explicitly in its manual, in the node Automatic refresh and revert.

However if you often use Git on the command line and inside Magit in parallel, then you might want to avoid having to press g when coming back to the status buffer from the command line. Enabling this mode avoids that.

But also note that refreshing the status buffer can still be slow in big repositories. If you are not satisfied with Magit’s performance then you should probably not enable this mode, as that would refresh the status buffer even more often, in many cases needlessly.

How do I use it?

To activate the minor-mode for a repository, open the status buffer for that repository and then call M-x magit-filenotify-mode RET. Repeat the same step to deactivate the mode again. To automatically enable the mode when opening a status buffer, add this to your init file:

(add-hook 'magit-status-mode-hook 'magit-filenotify-mode)

About

Refresh status buffer when git tree changes

Resources

Stars

Watchers

Forks

Packages

No packages published