GNU bug report logs - #77215
31.0.50; enable-theme-functions fires twice after a load-theme

Previous Next

Package: emacs;

Reported by: Filippo Argiolas <filippo.argiolas <at> gmail.com>

Date: Sun, 23 Mar 2025 17:55:02 UTC

Severity: normal

Found in version 31.0.50

To reply to this bug, email your comments to 77215 AT debbugs.gnu.org.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#77215; Package emacs. (Sun, 23 Mar 2025 17:55:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Filippo Argiolas <filippo.argiolas <at> gmail.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Sun, 23 Mar 2025 17:55:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Filippo Argiolas <filippo.argiolas <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Cc: Stefan Monnier <monnier <at> iro.umontreal.ca>
Subject: 31.0.50; enable-theme-functions fires twice after a load-theme
Date: Sun, 23 Mar 2025 18:54:14 +0100
Hi,

I noticed that my `enable-theme-functions' hook always fires twice after
either a `load-theme' or a `enable-theme'.

Problem is `enable-theme' in custom.el always also enables the user
theme to push it on top of the list.

Is this desired?

Technically I'd say it's correct, two enables spark two hooks, buyt from the
user point of view seems a counterintuitive side effect without digging
into the code.

Filippo




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#77215; Package emacs. (Mon, 24 Mar 2025 09:19:01 GMT) Full text and rfc822 format available.

Message #8 received at 77215 <at> debbugs.gnu.org (full text, mbox):

From: Mauro Aranda <maurooaranda <at> gmail.com>
To: Filippo Argiolas <filippo.argiolas <at> gmail.com>, 77215 <at> debbugs.gnu.org
Cc: Stefan Monnier <monnier <at> iro.umontreal.ca>
Subject: Re: bug#77215: 31.0.50; enable-theme-functions fires twice after a
 load-theme
Date: Mon, 24 Mar 2025 06:18:43 -0300
[Message part 1 (text/plain, inline)]
Filippo Argiolas <filippo.argiolas <at> gmail.com> writes:

> Hi,
>
> I noticed that my `enable-theme-functions' hook always fires twice
> after either a `load-theme' or a `enable-theme'.
>
> Problem is `enable-theme' in custom.el always also enables the user
> theme to push it on top of the list.
>
> Is this desired?
>
> Technically I'd say it's correct, two enables spark two hooks, buyt
> from the user point of view seems a counterintuitive side effect
> without digging into the code.
>
> Filippo

I think it would be good to avoid it.  The attached patch does that.
[0001-Avoid-running-enable-theme-functions-twice.patch (text/x-patch, attachment)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#77215; Package emacs. (Tue, 25 Mar 2025 05:23:02 GMT) Full text and rfc822 format available.

Message #11 received at 77215 <at> debbugs.gnu.org (full text, mbox):

From: Filippo Argiolas <filippo.argiolas <at> gmail.com>
To: Mauro Aranda <maurooaranda <at> gmail.com>, 77215 <at> debbugs.gnu.org
Cc: Stefan Monnier <monnier <at> iro.umontreal.ca>
Subject: Re: bug#77215: 31.0.50; enable-theme-functions fires twice after a
 load-theme
Date: Tue, 25 Mar 2025 06:22:17 +0100
Mauro Aranda <maurooaranda <at> gmail.com> writes:

> Filippo Argiolas <filippo.argiolas <at> gmail.com> writes:
>
>  > Hi,
>  >
>  > I noticed that my `enable-theme-functions' hook always fires twice
>  > after either a `load-theme' or a `enable-theme'.
>  >
>  > Problem is `enable-theme' in custom.el always also enables the user
>  > theme to push it on top of the list.
>  >
>  > Is this desired?
>  >
>  > Technically I'd say it's correct, two enables spark two hooks, but
>  > from the user point of view seems a counterintuitive side effect
>  > without digging into the code.
>  >
>  > Filippo
>
> I think it would be good to avoid it.  The attached patch does that.

Thanks, looks good to me and it fixes the problem here.

Filippo




This bug report was last modified 89 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.