[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#68352: 29.1; gnus-message-citation-mode removes values from font-loc
From: |
Morgan Willcock |
Subject: |
bug#68352: 29.1; gnus-message-citation-mode removes values from font-lock-keywords |
Date: |
Tue, 09 Jan 2024 22:21:18 +0000 |
User-agent: |
Gnus/5.13 (Gnus v5.13) |
Eric Abrahamsen <eric@ericabrahamsen.net> writes:
> Morgan Willcock <morgan@ice9.digital> writes:
>
>> When Gnus enables gnus-message-citation-mode in message buffers, as it
>> does by default, it calls the function `font-lock-set-defaults' and
>> loses any additional font-lock rules which may have been added by global
>> minor-modes.
>
> Thanks for the report. I don't know font locking well enough to know
> what the right solution is here. It looks calling `font-lock-flush' will
> also end up calling `font-lock-set-defaults' as well, at least with
> default values:
>
> font-lock-flush-function ->
> font-lock-after-change-function ->
> font-lock-fontify-region ->
> font-lock-set-defaults
>
> Is the problem setting `font-lock-set-defaults' to nil? Is there
> anything else you can recommend?
I think that I did test not setting `font-lock-set-defaults' to nil to
see if that made a difference, but the same problem was still there.
I don't know very much myself, but in that section of code there is a
comment left by Stefan Monnier:
;; FIXME: Use font-lock-add-keywords!
So I would guess that the correct solution would be to add the citation
font-locking rules with `font-lock-add-keywords' and then remove them
again with `font-lock-remove-keywords' if the mode is ever disabled, and
if the highlighting needs an update after those changes, call
`font-lock-flush'.
(When testing I'm not seeing that a call to `font-lock-flush' will lose
any values from `font-lock-keywords'.)
--
Morgan Willcock