GNU bug report logs - #79208
[PATCH] (setq-default,setopt): Warn about unknown vars.

Previous Next

Package: emacs;

Reported by: Eshel Yaron <me <at> eshelyaron.com>

Date: Sun, 10 Aug 2025 11:06:02 UTC

Severity: normal

Tags: patch

Full log


Message #11 received at 79208 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Eshel Yaron <me <at> eshelyaron.com>
Cc: 79208 <at> debbugs.gnu.org
Subject: Re: bug#79208: [PATCH] (setq-default,
 setopt): Warn about unknown vars.
Date: Mon, 11 Aug 2025 04:53:21 -0400
> This patch makes the byte-compiler (and by extension, Flymake), emit
> warnings when setq-default and setopt are used to set the value of
> unknown variables, similarly to the warnings we get with setq.

I think this is probably OK for `setq-default` but for `setopt` I'm not
sure it's a good idea: `setopt` is expected to be rarely used in ELisp
packages and more often in user init files.  User init files normally
lack the "needed" `require`s to silence those warnings, so it risks just
increasing the amount of false positives.

We should try and come up with some way for the byte-compiler to emit
useful warnings when compiling init files, but AFAIK we don't have
that yet.

> Ideally we should do something similar for setq-local, but AFAICT that
> requires a different solution due to different implementation details.

Adding the warning for `setq-local` risks a similar problem: it's fairly
common for major modes to `setq-local` some vars for optional
third-party packages, which may not even be installed.  AFAIK we don't
really have a good answer for those problems either, the only "solution"
we have would be `with-suppressed-warnings`.


        Stefan





This bug report was last modified 30 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.