Turning Off Annoying Magit Prompts

As most of you know, I'm a big fan of Magit and have been using it for some time. One thing I didn't like was that it asked for verification before staging all changed files (【S】 in magit-status) but being Emacs that was easily fixed. With the new Magit, that fix no longer works. We were warned that some of the variable names were changed so I thought, “No problem, I'll just grep for the prompt string and see what the new magic incantation is.” Sadly, nothing was found. That's because of the way prompts work in Magit 2.x; you have to add the prompt's identifier to the magit-no-confirm list. For the stage all prompt, that identifier is stage-all-changes.1

I also noticed that Magit now wants me to confirm where I want to push my commits. There's a long explanation of the reasons for this change in the doc string of the magit-push-always-verify variable. The TL;DR is that it's an attempt to make everyone happy.

Here's the code that configures Magit and eliminates both prompts:

1: (use-package magit
2:   :ensure t
3:   :bind ("C-x g" . magit-status)
4:   :config
5:   (add-to-list 'magit-no-confirm 'stage-all-changes)
6:   (setq magit-push-always-verify nil)
7:   (setq magit-last-seen-setup-instructions "2.1.0"))

The important part for eliminating the Stage all changes? prompt is on line 5. You have to execute that after Magit is loaded. To get rid of the push verify prompt, use line 6.

Footnotes:

1

The prompt is derived from the identifier by removing the dashes, capitalizing the first character, and appending a ‘?’.

This entry was posted in General and tagged , . Bookmark the permalink.