Warn when customizing minor-mode vars for ERC modules
* lisp/erc/erc-common.el: (erc--inside-mode-toggle-p): Add global var
to inhibit mode toggles from being run by `erc-update-modules'. It
must be non-nil inside custom-set functions for mode toggles created
by `define-erc-module'.
(erc--favor-changed-reverted-modules-state): Add new helper to show a
"SET" Custom state for `erc-modules' except when reverting to the
default value because \"STANDARD\" always takes precedence, as
explained somewhat in bug#12864.
(erc--assemble-toggle): Don't modify `erc-modules' when run from
custom-set function.
(erc--neuter-custom-variable-state): Add new function to serve as a
phony getter that deceives Customize into thinking the variable is
always set to its standard value. The justification for this is that
toggling a module's minor mode in Customize has never worked and has
only sewn confusion in new users. Without this hack, mode widgets
show a state of "CHANGED outside Customize", which alone is probably
preferable, except that they all end up toggled open, bringing them
unwanted attention and distracting the user.
(erc--tick-module-checkbox): Add helper to toggle the appropriate
checkbox in the `erc-modules' widget when a user interactively toggles
a minor-mode state variable.
(erc--prepare-custom-module-type): Create spec for minor-mode Custom
`:type', deferring various aspects until module-definition time.
(define-erc-module): Add `:get' and `:type' keywords to be passed to
`defcustom' definition for global modules.
* lisp/erc/erc.el (erc-modules): Inhibit `erc-update-modules' when run
from a minor-mode toggle's custom-set function.
* test/lisp/erc/erc-tests.el (define-erc-module--global,
define-erc-module--local): Update `erc-modules' mutations with
`erc--inside-mode-toggle-p' guard conditions. (Bug#60935.)