bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#62889: 29.0.60; (setopt ...) does not give "assignment to free varia


From: Philip Kaludercic
Subject: bug#62889: 29.0.60; (setopt ...) does not give "assignment to free variable" warning
Date: Tue, 18 Apr 2023 19:20:41 +0000

ar0x2ff@gmail.com writes:

> Philip Kaludercic writes: 
>> var2 should also not be highlighted, since the first argument to the
>> function `customize-set-variable' is a symbol, and the byte compiler
>> correctly states that it doesn't know that any variable "var2" will be
>> defined.
>> 
>> If you macroexpand setopt, you will see that it generates
>> 
>>   (setopt--set 'var3 2)
>> 
>> which is all fine, since no functions are being invoked with undefined
>> variables.
>> 
>> The reason this makes sense is that not all user options have to be
>> loaded when they are set.  A number of them are even auto-loaded and
>> will load the library for the necessary user-option setters if
>> necessary.
>
> I was aware of the "do not overwrite custom variable if set before library 
> load" mechanism, but I also seem to remember the (customize-set-variable ...) 
> function to throw "free variable" warnings (e.g. when i open custome.el), so 
> i 
> kind of took for granted that it was correct behaviour.
>
> Glad to know (setopt ...) works this way! No more warning suppress in my init 
> file :)

Great, then I will close the report.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]