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

From: Eli Zaretskii <[email-masked]>
Date: Fri, 21 Feb 2020 09:40:34 +0200

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

Thanks.

The fix installed on master is in a much more general place, and will
affect much more than just occur-engine.  I'm okay with a bug-fix
change on the release branch which is local to this place in
replace.el, but I don't want to risk breaking unrelated code by
changing font-lock.el.

Another alternative is to revert the offending changes in fb16313025
on the release branch.  Since it is an enhancement, perhaps we could
live without it in Emacs 27.