bug#81372: 30.2; make setopt warn on type mismatch in more cases

Stéphane Marks <[email protected]> Wed, 29 Jul 2026 22:04:39 +0200
Newsgroups gmane.emacs.bugs
Message-ID <CAN+1HbqdVGOK2SrhUYfBjHweF81NHEEK50bi+zHqx7EWd4h6rQ@mail.gmail.com>
On Tue, Jul 28, 2026 at 4:10 PM Stefan Monnier <[email protected]>
wrote:

> > I think the patch below will at least get rid of the double-warning.
> > It doesn't fix the OP's problem nor does it fix the fact that the
> > warning's text will be different depending on whether we end up
> > performing the test in `setopt--set` or `custom-initialize-reset`.
>
> I've come around to agreeing that it's OK if the message is not
> the same.  🙂
>
> Here's my current suggestion.  It includes FIXME comments in
> `setopt--set-local` about which I'd like to have Stephane's opinion, tho
> this shouldn't stop us from moving with the `setopt--set` part.
>

We could improve and share type checking code for both setopt and
setopt-local and rename the custom variable setopt-local-type-mismatch to
something like setopt-type-mismatch or create two variables one for each
context or otherwise have it be a cons global . local treatment like (setq
setopt-type-mismatch (cons 'accept 'discard)).

I think the reason this was implemented for set-local only was due to
file/directory variables being less intentional than someone's
configuration in which setopt would be under their full control.