bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


From: Drew Adams
Subject: bug#34764: prettify-symbols-mode pollutes font-lock-extra-keywords
Date: Tue, 5 Mar 2019 15:54:26 -0800 (PST)

> I'm a bit puzzled by the implementation:
> 
> (remove-hook 'post-command-hook
>              #'prettify-symbols--post-command-hook t)
>     (when prettify-symbols--keywords
>       (font-lock-remove-keywords nil prettify-symbols--keywords)
>       (setq prettify-symbols--keywords nil))
>     (when (memq 'composition font-lock-extra-managed-props)
>       (setq font-lock-extra-managed-props
>             (delq 'composition font-lock-extra-managed-props))
>       (with-silent-modifications
>         (remove-text-properties (point-min) (point-max)
>                                 '(composition nil))))))

I'm ignorant wrt prettify-symbols stuff.  But to me
it smells like a bug for some optional code (e.g. a
mode) to change a general setting such as `composition'
for `font-lock-extra-managed-props' etc. when it's done.

Should prettify-* assume it's the only code that cares
about property `composition'?  Or that it was the one
that added/set it in the first place?

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.

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.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]