Subject: bug#33682: 27.0.50; enriched-mode cannot save anonymous faces

From: [email-masked] (Charles A. Roelli)
Date: Sun, 09 Dec 2018 17:35:28 +0100

> Date: Sun, 09 Dec 2018 14:55:39 +0200
> From: Eli Zaretskii <[email-masked]>
> CC: [email-masked]
>
> Thanks.
> 
> When setting colors and other properties in Enriched mode, you are
> supposed to use commands from facemenu.el (and/or the menu-bar menu
> items it produces, under Edit->Text Properties).
> 
> The immediate reason for the error is that you should do this instead:
> 
>   M-: (insert (propertize "foo" 'face '((:background "red")))) RET

Thanks for pointing this out.  So enriched mode can save a face
property which is a list of (possibly anonymous) faces, but it chokes
on a single anonymous face.  Is that documented somewhere?

> but I'm not sure we want to extend enriched.el to support arbitrary
> face specs.  What is the real-life use case for that?

Text created by other programs may not be aware of enriched mode's
limitations.  For example, here is an (abbreviated) version of how I
found this bug (from emacs-26):

C-x C-f test/manual/indent/css-mode.css
M-x enriched-mode RET y
C-x C-s

Evidently some text in CSS buffers is fontified with a single
anonymous face, which enriched mode does not support.  For a real-life
use case, if you copy some text from a CSS buffer and yank it in an
enriched mode buffer, the buffer can (temporarily) no longer be saved.