1

I'm trying to teach magit that git pull --rebase should always --autostash. pull --rebase is always my default, so I want --autostash to be the default as well.

The 5th argument of magit-define-popup-switch is documented as

If optional ENABLE is non-nil, then the switch is on by default.

however, when I do

(magit-define-popup-switch 'magit-pull-popup ?A "Autostash" "--autostash" t)

the switch is not on by default. I get the same behavior when I simply do

(magit-define-popup-switch 'magit-pull-popup ?A "Autostash" "--autostash")

What am I misunderstanding?

0

That argument only adds the argument to the default value of the respective variable, but you are probably not using the default value.

If you save a popup's arguments using C-x C-s (from the popup), then that value will be used. You have probably done that in the past and can easily "fix" it by doing it again, this time after enabling --autostash. Alternatively you can use the Custom interface to reset magit-push-arguments to the default value.

  • Indeed magit-pull-arguments was defined to --rebase, probably from a quite old magit version; clearing this did the trick. In my mind I was adding a new switch, so this switch could not have a previous state, and should have honored the default setting I specified. Now I understand that switch don't have states, but popups do have sets of enabled switches and defaults for such sets. Thanks! – adl Feb 27 '18 at 15:26
  • Yep, that last sentence summarizes it well. – tarsius Feb 27 '18 at 16:26

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.