I would like to define a variable using
defcustom so that it can be customized by users of an emacs package. The variable is an integer (let's call it
spam-override), and its function is to override the value of another integer variable (
0 is an allowed value of both
spam-override is set to
0, that means "override with the value 0" rather than "do not override". It seems natural to allow
nil to indicate that the override is disabled.
I suspect that using
nil in this way isn't how
defcustom is best used for variables of this kind.
What's the best way to achieve this functionality? For example, is it usually best to use a composite
defcustom type by using the
choice constructor, or to define an extra boolean variable, maybe named
override-spam to indicate whether integer variable
spam-override should be used?