When commit.gpgSign = true, all commits are signed by default. However, in the commit popup, the =S option doesn't show up bolded, potentially confusing users as to whether or not the commit is going to be signed.
I think it would be intuitive if magit recognized that commit.gpgSign = true, meaning that all commits are signed anyways, and so would show the =S option bolded, conveying that it's taking effect.
Then, by extension, if the user pressed =S so as to "deactivate" that option, it would take the effect of --no-gpg-sign, which exempts the commit from commit.gpgSign = true, i.e. that commit will not be gpg signed.
Countermand commit.gpgSign configuration variable that is set to force each and every
commit to be signed.
In the long run I want to add support for this sort of thing but it's not as easy as you make it sound. You can save popup arguments for future use using C-x C-s, but what if you also set the variable? Should the arguments have higher precedence since it is "more local to Magit"? But since it is possible to set the variable local to a repository but not the variable maybe not? And so on.
In the short run you can accomplish the same by adding the _variable_ to the popup:
(magit-define-popup-variable 'magit-commit-popup ?g ""
(lambda ()
(interactive)
(magit-set (if (magit-get-boolean "commit.gpgSign") "false" "true")
"commit.gpgSign"))
(lambda ()
(format "commit.gpgSign (%s)"
(if (magit-get-boolean "commit.gpgSign")
(propertize "true" 'face 'magit-popup-option-value)
(propertize "false" 'face 'magit-popup-disabled-argument)))))
Fair enough! Indeed I hadn't considered those scenarios.
Thanks for the code! It's always nice to see the ways in which magit can be extended.
Most helpful comment
In the long run I want to add support for this sort of thing but it's not as easy as you make it sound. You can save popup arguments for future use using
C-x C-s, but what if you also set the variable? Should the arguments have higher precedence since it is "more local to Magit"? But since it is possible to set the variable local to a repository but not the variable maybe not? And so on.In the short run you can accomplish the same by adding the _variable_ to the popup: