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

From: Eli Zaretskii <[email-masked]>
Date: Tue, 26 Jan 2016 22:15:22 +0200

> From: Artur Malabarba <[email-masked]>
> Cc: [email-masked]
> Date: Tue, 26 Jan 2016 17:25:36 +0000
> 
> >>     (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.

So disable-theme actually means go back to the default theme?  If so,
when someone changes a theme, they don't really need to call
disable-theme, right?  They could just call load-theme with the new
theme as an argument?

> 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.

Then it would make sense to find a way of switching a theme without
changing the frame's background color, if that's possible (i.e. if the
new theme keeps the same background color).  If there's a function
missing for that, I'd suggest to add one.