GNU bug report logs - #34764
prettify-symbols-mode pollutes font-lock-extra-keywords

Previous Next

Package: emacs;

Reported by: Clément Pit-Claudel <cpitclaudel <at> gmail.com>

Date: Tue, 5 Mar 2019 22:16:02 UTC

Severity: minor

Full log


Message #8 received at 34764 <at> debbugs.gnu.org (full text, mbox):

From: Drew Adams <drew.adams <at> oracle.com>
To: Clément Pit-Claudel <cpitclaudel <at> gmail.com>,
 34764 <at> debbugs.gnu.org
Subject: RE: 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.




This bug report was last modified 5 years and 232 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.