Subject: bug#68352: 29.1; gnus-message-citation-mode removes values from font-lock-keywords

From: Morgan Willcock <[email-masked]>
Date: Wed, 10 Jan 2024 22:16:27 +0000

Eric Abrahamsen <[email-masked]> writes:

> So maybe this is enough?
>
> (define-minor-mode gnus-message-citation-mode
>   "Minor mode providing more font-lock support for nested citations.
> When enabled, it automatically turns on `font-lock-mode'."
>   :lighter ""
>   (when (derived-mode-p 'message-mode)
>     (if gnus-message-citation-mode
> 	(font-lock-add-keywords nil gnus-message-citation-keywords)
>       (font-lock-remove-keywords nil gnus-message-citation-keywords))
>     (if font-lock-mode
> 	(font-lock-flush)
>       (gnus-message-citation-mode (font-lock-mode 1)))))

I think this does fix it, although I've added the optional argument to
append to the end of the font-lock rules and restored the comment which
suggested why it previously worked that way.

  (define-minor-mode gnus-message-citation-mode
    "Minor mode providing more font-lock support for nested citations.
  When enabled, it automatically turns on `font-lock-mode'."
    :lighter ""
    (when (derived-mode-p 'message-mode)
      (if gnus-message-citation-mode
          ;; `gnus-message-citation-keywords' should be the last
          ;; elements of the keywords because the others are unlikely to
          ;; have the OVERRIDE flags -- XEmacs applies a keyword having
          ;; no OVERRIDE flag to matched text even if it has already
          ;; other faces, while Emacs doesn't.
          (font-lock-add-keywords nil gnus-message-citation-keywords t)
        (font-lock-remove-keywords nil gnus-message-citation-keywords))
      (if font-lock-mode
          (font-lock-flush)
        (gnus-message-citation-mode (font-lock-mode 1)))))

-- 
Morgan Willcock