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

From: Kévin Le Gouguec <[email-masked]>
Date: Thu, 20 Feb 2020 23:27:41 +0100

Eli Zaretskii <[email-masked]> writes:

> Can you show what commit introduced that?

Yup; quoting Juri above:

>> I think commit fb16313025 (2018-12-18T23:10:09Z!juri <at> linkov.net) had an
>> unintended side-effect on fundamental-mode.  From emacs -Q:
> 
> This commit contains this change:
> 
> diff --git a/lisp/replace.el b/lisp/replace.el
> index dcae12e9b7..b8f231eb55 100644
> --- a/lisp/replace.el
> +++ b/lisp/replace.el
> @@ -1907,10 +1907,8 @@ occur-engine
>        global-matches)))
>  
>  (defun occur-engine-line (beg end &optional keep-props)
> -  (if (and keep-props (if (boundp 'jit-lock-mode) jit-lock-mode)
> -	   (text-property-not-all beg end 'fontified t))
> -      (if (fboundp 'jit-lock-fontify-now)
> -	  (jit-lock-fontify-now beg end)))
> +  (if (and keep-props font-lock-mode)
> +      (font-lock-ensure beg end))
>    (if (and keep-props (not (eq occur-excluded-properties t)))
>        (let ((str (buffer-substring beg end)))
>  	(remove-list-of-text-properties

$ git branch --remote --contains fb16313025 | grep origin/emacs-
  origin/emacs-27