Subject: bug#20766: 24.5; disable-theme leaves lingering effects

From: Mauro Aranda <[email-masked]>
Date: Sat, 8 Mar 2025 06:45:35 -0300

close 20766 28.1
quit

Mauro Aranda <[email-masked]> writes:

 > Anders Papitto <[email-masked]> writes:
 >
 >> When I run these commands from a fresh Emacs instance
 >>
 >> M-x load-theme RET solarized-light RET
 >> M-x disable-theme RET solarized-light RET
 >> M-x term RET RET
 >>
 >> the text background color in term-mode stays what it was set to by the
 >> solarized-light theme. A very similar invocation does not have this
 >> behavior:
 >>
 >> M-x term RET RET
 >> C-c k RET yes RET
 >> M-x load-theme RET solarized-light RET
 >> M-x disable-theme RET solarized-light RET
 >> M-x term RET RET
 >>
 >> i.e. If term mode gets to run before loading the theme, no bug.
 >>
 >
 > This bug is still present.
 >
 > It looks like solarized still sets the obsoleted variables
 > term-default-fg-color and term-default-bg-color, but still, the bug is
 > in custom.el and it's related to Bug#21355.
 >
 > Here's a recipe:
 > Save this theme into test-bug20766-theme.el, and arrange to load it.
 > (deftheme test-bug20766)
 >
 > (custom-theme-set-variables
 >  'test-bug20766
 >  '(test-option 'foo))
 >
 > (provide-theme 'test-bug20766)
 >
 > emacs -Q
 >
 > M-x load-theme RET test-bug20766
 > test-option is not yet known, so custom stores the theme setting under
 > the saved-value property of test-option.
 >
 > M-x disable-theme RET test-bug20766
 > The saved-value property should be nil, because the theme setting is no
 > longer relevant.  However, it's still ('foo).
 >
 > Then eval the following defcustom:
 > (defcustom test-option 'bar "..."
 > :type 'symbol
 > :group 'emacs)
 >
 > M-: test-option ==> foo, which is wrong.
 >
 > In the original recipe, that is how term-default-fg-color and
 > term-default-bg-color get the solarized theme setting after loading
 > term.

This is fixed since this commit:

commit 779c615f333a01d11ab930b030d61545fb048f3d
Author: Mauro Aranda <[email-masked]>
Date:   Mon May 10 13:33:32 2021 +0200

     Avoid saving session customizations in the custom-file

Closing.