GNU bug report logs - #73609
29.1; use-package overwrites custom variables in byte-compiled files

Previous Next

Package: emacs;

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 #8 received at 73609 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Al Haji-Ali <abdo.haji.ali <at> gmail.com>
Cc: 73609 <at> debbugs.gnu.org
Subject: Re: bug#73609: 29.1;
 use-package overwrites custom variables in byte-compiled files
Date: Thu, 03 Oct 2024 14:02:23 +0300
> From: Al Haji-Ali <abdo.haji.ali <at> gmail.com>
> Date: Thu, 03 Oct 2024 06:47:51 +0100
> 
> 
> In my config file, I have a use-package statement like this
> 
> ,----
> | (use-package org
> | :custom
> | (org-log-reschedule nil))
> `----
> 
> If I byte-compile my config file, run Emacs and run:
> 
> ,----
> | (message "START value is %S" org-log-reschedule)
> | (setq org-log-reschedule t)
> | (message "BEFORE value is %S" org-log-reschedule)
> | (define-advice enable-theme (:before (theme) enable-theme <at> debug)
> |     (message "Loading theme %S" theme)))
> | (require 'use-package)
> | (message "AFTER value is %S" org-log-reschedule)
> `----
> 
> I get the messages:
> ,----
> | START value is nil
> | BEFORE value is t
> | Loading theme `use-package`
> | AFTER value is nil
> `----
> 
> I believe that is because, in my byte-compiled config, `use-package` is no longer required since all `use-package` statements are expanded. This means that `use-package-core` is also no longer required and in that file, a naked (enable-theme 'use-package) statement, which resets all custom random variables, is always executed. This is exactly what happens when I eventually require `use-package`.
> 
> I can fix this by simply always requiring `use-package` in my config so that the enable-theme statement in `use-package-core` is executed before I modify any variables. Alternatively, this small patch seems to fix the root cause of the issue.

Can you try this with the latest emacs-30 branch of the Emacs Git
repository?  I believe some changes were done to use-package there,
and they might fix your problem as well.

Thanks.




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.