Subject: bug#32072: 27.0.50; clear-face-cache in an X frame breaks tty colors

From: Istvan Marko <[email-masked]>
Date: Mon, 09 Jul 2018 00:17:27 -0700

Eli Zaretskii <[email-masked]> writes:

> Can you tell more about what "messed-up" means?  E.g., what do you see
> if you type "M-x list-colors-display RET" in a TTY frame after
> invoking clear-face-cache on a GUI frame?

Interestingly the colors of list-colors-display remain intact (except
for the modeline). list-faces-display however shows the problem.

Here are some screenshots with the M-x list-faces-display buffer from an
emacs-client -t frame on a 256 color terminal before and after running
clear-face-cache in the X11 frame.

Normal: https://i.imgur.com/QPUbARN.png

Bad: https://i.imgur.com/080IjKI.png

Note that some colors are retained, for example the background of
tty-menu-selected-face which is "red", a color that exists on 16 color
terminals too.

> Or do you mean that a _second_ call to clear-face-cache fixes the TTY
> frames?  

Yes, this. Calling clear-face-cache again, this time from the 256 color
TTY frame, fixes the TTY frames.

> If the latter, does it matter what frame is selected when you issue
> that second call?

Yes, the second call only helps if it's done while the 256 color TTY
frame is the active one.

> What if you invoke clear-face-cache, and then type "M-x redraw-display
> RET" in a TTY frame -- does that still show "messed-up" colors?

M-x redraw-display in the tty frame does not help.

> "Black or green"?  So the effect is not entirely deterministic?

I think it's deterministic but may have a couple of variations depending
on the state of my Emacs session or the terminal. I haven't figured
out

> Do you see this in Emacs 26 as well, or only on the master branch?

Yes, I see this with both 26 and master. I am fairly sure that this
wasn't happening about 2 years ago. Perhaps it started when I switched
from 25 to 26 but not sure. I am having trouble building an old enough
version on my current Linux system to verify but if we get stuck I will
find a way to build it and try to bisect.

-- 
	Istvan