Subject: bug#34764: prettify-symbols-mode pollutes font-lock-extra-keywords

From: Drew Adams <[email-masked]>
Date: Tue, 5 Mar 2019 22:23:06 -0800 (PST)

> > Typically, I use a library-specific property instead
> > (e.g. `my-composition') and do whatever is needed to
> > give that property an effect like the general (global)
> > property, without interfering with that general property.
> 
> I never thought about this solution.  This is great actually!   I'm
> aware of char-property-alias-alist, but I never quite realized that it
> provided an elegant solution to the problem of restoring font-lock-
> extra-managed-props when disabling a minor mode (the only user in the
> emacs source tree seems to befont-lock).  Is that the mechanism you had
> in mind?

No, in fact I wasn't aware of `char-property-alias-alist'. ;-)

I just meant in some way to try to have a library-specific
property control or replace a general property.  I don't
have in mind a general mechanism for doing that.

> > Maybe that's not appropriate for prettify-*.  Dunno.
> >
> > Or I keep track of the initial state before adding
> > `composition', and then reset that property only if it
> > wasn't used to begin with (i.e., restore its value).
> >
> > But that's not foolproof either, since some other code
> > can affect things after prettify-* is turned on, so
> > restoring to the state before it was turned on isn't
> > necessarily TRT.
> >
> > Maybe such a save/restore approach is not easy/possible
> > for prettify-*.  Dunno.
> 
> Right, I think that approach is doomed, because modes are not enable
> and disabled in a well-parenthesized manner (you can enable A, enable
> B, disable A, and disable B)

Yes.  But it kinda depends on how "big", longlasting or
important a (minor) mode is.  If it's something that
you tend to leave on a lot, as a basic Emacs customization
then you can sometimes live with just restoring the
previously ~virgin state when you toggle it off briefly.

But yeah, it depends.
 
> Thanks for the cool idea about char-property-alias-alist!

It was your idea!  Let us know how you make do with it.