GNU bug report logs -
#79208
[PATCH] (setq-default,setopt): Warn about unknown vars.
Previous Next
Full log
Message #14 received at 79208 <at> debbugs.gnu.org (full text, mbox):
Stefan Monnier <monnier <at> iro.umontreal.ca> writes:
>> 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.
Indeed, it's likely to surface false positives, and we should try to
minimize those. But especially in init files, it's important to warn
about typos in variable names, because users are more likely to be left
puzzled by such a mistake than people doing more serious development.
> 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.
Hmm, is it really a different situation from setq?
> AFAIK we don't really have a good answer for those problems either,
> the only "solution" we have would be `with-suppressed-warnings`.
What about declaring these variables with unary defvar forms?
(Not perfect either, of course, but it is also a solution, no?)
Thanks,
Eshel
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.