I've seen the post Magit: Auto-refresh “magit-status”, and tarsius recommends the same method from the Magit manual to set magit-after-save-refresh-status
to non-nil to the after-save-hook
:
(add-hook 'after-save-hook 'magit-after-save-refresh-status t)
This is a great solution when a Magit buffer is available. However, if this setting causes some noisy warnings when saving a file when a Magit buffer is not available:
run-hooks: Symbol’s function definition is void: magit-after-save-refresh-status
How can I get around this such that this setting is active only when there is a Magit buffer available?