I use smart-mode-line package and I noticed when I change/checkout branches in command line, or in Magit, this is not reflected in the Smart Mode Line. I still see the name of the old branch, while I checked out the other branch.

I need to call M-x revert-buffer to see the actual branch reflected in Smart Mode Line.

These option gives me an error, while in documentation I need to supply REVISION in magit-checkout parameter, which is unknown in Emacs Lisp as variable:

  (add-function :after (magit-checkout) #'revert-buffer)

And this didn't help either:

(setq magit-auto-revert-mode t)

So I'm running out of ideas. Anyone?

  • Your first code fragment should something more like (advice-add 'magit-checkout :after #'revert-buffer)
    – npostavs
    Commented Aug 1, 2017 at 20:06
  • See force-mode-line-update.
    – Dan
    Commented Aug 1, 2017 at 20:36
  • Didn't help unfortunately. Nevertheless, thanks for your response.
    – ReneFroger
    Commented Aug 8, 2017 at 19:59

1 Answer 1


magit-auto-revert-mode is a mode and therefore should be enabled by calling the mode function, not by setting the variable. But it is supposed to be enabled by default, so you shouldn't have to do that.

(But you might have disabled this a long time ago, possibly using an old implementation, so it might get disabled for non-obvious reasons. Check your configuration for occurrences not only of magit-auto-revert-mode, but also magit-revert-buffers, and remove all that.)

For me the buffer information gets automatically updated without any additional configuration and I am using smart-mode-line too. So you should proceed by disabling your own customization and all packages not required by magit and check whether it works then. If so, proceed by enabling more and more of your packages and customization until it breaks again. This will allow you to narrow the issue down.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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