Anders Papitto <anderspapitto@gmail.com> 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.