Subject: bug#22466: 25.0.50; disable-theme apparently forces a redisplay and causes a screen flash

From: Artur Malabarba <[email-masked]>
Date: Tue, 26 Jan 2016 17:25:36 +0000

Eli Zaretskii <[email-masked]> writes:

> It's not redisplay that does this.  It's the fact that disable-theme
> changes the frame's background color, and when that happens, we
> immediately clear the frame using the new background color, as part of
> the modify-frame-parameters call.
>
> Redisplay only handles the portions of display where there's text and
> other decorations that we manage.  Clearing the frame with the new
> background color is not redisplay's job.

Thanks, that's good to know.

>>     (set-frame-parameter frame 'background-color
>>     			     (custom--frame-color-default
>>     			      frame :background "background" "Background"
>>     			      "unspecified-bg" "white"))
>> 
>> I'm not saying this form is wrong. I'm just pointing to where it happens.
>
> What happens if you remove that from disable-theme?

Then there's no flashing, but then if I simply disable the theme
(without enabling a new one) I'm left with theme's background.

> (I don't really understand why it has to specify "white".)

I guess it's meant to reset the face to the default. Although, I don't
see why this is explicitly necessary for the default
background/foreground colors, but isn't necessary for other faces.

> Anyway, how come you get to doing this so often it hurts your eyes?
> Aren't people setting their beloved theme once when the session
> starts, and then never change it?

I never change my main color theme, but I always have a second theme
enabled that only affects the mode-line. This second theme is changed
occasionally and it always causes a flash (even though the theme has
nothing to do with the background).

Besides, custom themes are not just for faces. This also came up because
someone is writing a package that simultaneously toggles between
different values for a set of variables (called a context) using
custom-themes. That's something that's designed to be used a couple
times a day.

Anyway, it's not a huge defficiency and it's not worth any large
efforts. I brought it up because I thought there was an eager redisplay
happening somewhere and that might point to a deeper bug, but you've
clearly explained that's not the case. :-)