unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: Al Haji-Ali <abdo.haji.ali@gmail.com>
Cc: 73609@debbugs.gnu.org
Subject: bug#73609: 29.1; use-package overwrites custom variables in byte-compiled files
Date: Thu, 03 Oct 2024 14:02:23 +0300	[thread overview]
Message-ID: <86frpdzby8.fsf@gnu.org> (raw)
In-Reply-To: <m2jzepyby0.fsf@gmail.com> (message from Al Haji-Ali on Thu, 03 Oct 2024 06:47:51 +0100)

> From: Al Haji-Ali <abdo.haji.ali@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@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.





  reply	other threads:[~2024-10-03 11:02 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-03  5:47 bug#73609: 29.1; use-package overwrites custom variables in byte-compiled files Al Haji-Ali
2024-10-03 11:02 ` Eli Zaretskii [this message]
2024-10-11 22:25   ` Al Haji-Ali
2024-10-12  8:07     ` Eli Zaretskii
2024-10-12 15:22       ` John Wiegley
2024-10-13 17:31         ` Al Haji-Ali
2024-10-14 15:10           ` John Wiegley

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=86frpdzby8.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=73609@debbugs.gnu.org \
    --cc=abdo.haji.ali@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).