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 #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Clément Pit-Claudel <cpitclaudel <at> gmail.com>
To: bug-gnu-emacs <bug-gnu-emacs <at> gnu.org>
Subject: prettify-symbols-mode pollutes font-lock-extra-keywords
Date: Tue, 5 Mar 2019 17:15:03 -0500
Hi all,

When turned off, prettify-symbols-mode removes 'composition' from font-lock-extra-keywords, but not prettify-symbols-start or prettify-symbols-end; as a result, every time prettify-symbols-mode is turned on, it adds two new elements to font-lock-extra-keywords.

(I ran into this issue because I added a watcher on font-lock-extra-keywords to debug an intermittent font-lock problem, and the increasingly long lists of prettify-symbol-* entries made things harder to read).

I'm happy to provide a patch, but 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))))))

Would it be simpler to just call font-lock-unfontify-region-function and remove all three properties from font-lock-extra-managed-props?

Cheers,
Clément.

In GNU Emacs 27.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.22.30)
 of 2019-02-28 built on clem-w50-mint
Repository revision: 5d60229bf1a9a496102fc2a3ef9e57dcce7bef10
Repository branch: master
Windowing system distributor 'The X.Org Foundation', version 11.0.11906000
System Description: Linux Mint 19.1




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.