GNU bug report logs -
#73609
29.1; use-package overwrites custom variables in byte-compiled files
Previous Next
Reported by: Al Haji-Ali <abdo.haji.ali <at> gmail.com>
Date: Thu, 3 Oct 2024 05:51:02 UTC
Severity: normal
Found in version 29.1
Done: Eli Zaretskii <eliz <at> gnu.org>
Bug is archived. No further changes may be made.
Full log
Message #20 received at 73609 <at> debbugs.gnu.org (full text, mbox):
Hello,
On 12/10/2024, John Wiegley wrote:
> I don’t fully understand. The purpose of of `:custom (X Y)` is exactly to customize X to the value Y using the value setting functions of the customization framework.
>
> Is the user expecting that byte-compilation would cause the value to be set without loading use-package?
No, the point is that this is already the case, and that is causing a discrepancy between having a compiled file vs not. The original message had the context, but if you've seen that already, here's another crack at explaining. Apologies for the repetition.
The function definition above essentially has the sequence:
1- load a file that uses `use-package` with a `:custom` statement to set a variable.
2- modify said variable to some other value.
3- require `use-package`.
4- Check value of variable.
If the file is not compiled, then `use-package` is loaded in step 1 in order to expand the `use-package` statement. This means that the third step doesn't do anything, and the value of the variable is set to whatever I had in step 2.
However, if the file is compiled, the first step does not load `use-package`, due to lazy loading and since all `use-package` macro calls are expanded in a compiled file. This means that the loading of `use-package` happens in the third step, after I have modified the variable. The in turns loads `use-package-core` and the 'use-package theme is enabled, which resets the value of all custom variables that were set using `:custom` statements. The final result is that value of the variable in step 4 is the one from step 1, rather than step 2.
I hope this clarifies the issue. I included a potential patch in my original message which fixes the issue, but I am not sure if it would have unintended consequences,
-- Al
This bug report was last modified 198 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.