when executing magit-status and quickly focus out emacs, after the magit buffer pops up, emacs grabs the focus back. This is quite inconvenient. Is there a way to prevent that focus changing?

The way to reproduce this issue:

  1. emacs -Q and load magit.
  2. using magit-status command to load a middle size git project (which takes 1-2 seconds).
  3. in the meantime, quickly focus away from the Emacs frame, say clicking on a browser window.
  4. when magit-status buffer pops up, it grabs the focus back (which is what I'm trying to avoid)


Emacs 27.0.50
magit d9ae466377b30d544fcbf5c57af1a60b350931af
  • Maybe you can take a look at the variable magit-display-buffer-noselect, it seems when it is the default value, the function magit-display-buffer tries to raise the frame. FWIW, I can't reproduce the issue on Mac.
    – xuchunyang
    Mar 14 '18 at 19:21
  • @xuchunyang magit-display-buffer-noselect works! thank you.
    – Amos
    Mar 15 '18 at 2:17
  • 2
    Could one of you please turn this into an answer?
    – tarsius
    Mar 17 '18 at 12:41

Set magit-display-buffer-noselect to t to prevent magit-display-buffer from calling select-window.

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.