Subject: bug#39597: 27.0.60: M-x occur adds fontification to fundamental-mode

From: Kévin Le Gouguec <[email-masked]>
Date: Tue, 25 Feb 2020 21:45:29 +0100

Juri Linkov <[email-masked]> writes:

>> [1] E.g. (I was about to report this as a distinct issue… someday…)
>>
>>     C-x b foo
>>     foo RET bar RET baz RET
>>     M-s h r a RET RET
>>     aaaa
>>
>>     ⇒ In all modes *but* fundamental-mode, hi-lock-mode dynamically
>>     highlights new matches (e.g. the added "aaaa" string here).
>>
>>     This bug is not strictly related to the current one, since the
>>     former has been with us since at least 26.3, but that does make me
>>     wonder whether both issues could be solved by turning some font-lock
>>     knob in fundamental-mode…
>
> Searching for "font-lock-specified-p" in hi-lock.el
> shows these fragments of code.  This first condition decides
> whether to use font-lock for highlighting matches
> that returns nil in fundamental-mode:
>
>       (if (and font-lock-mode (font-lock-specified-p major-mode))
>
>       ;; FIXME: Calling `font-lock-remove-keywords' causes
>       ;; `font-lock-specified-p' to go from nil to non-nil (because it
>       ;; calls font-lock-set-defaults).  This is yet-another bug in
>       ;; font-lock-add/remove-keywords, which we circumvent here by
>       ;; testing `font-lock-fontified' (bug#19796).

Thanks, I'll look into this SomeDay™ before I submit a bug report then.

And thank you for fixing the other bug on emacs-27 and master!