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

From: Juri Linkov <[email-masked]>
Date: Tue, 18 Feb 2020 02:12:32 +0200

> I think commit fb16313025 (2018-12-18T23:10:[email-masked]) 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

> - C-x b repro RET
> - foo RET "bar" RET baz
> - M-s o . RET
>
> In emacs 26.3, the Occur buffer pops up and not much else happens;
> starting with emacs 27, font-lock-string-face is applied to "bar".
>
> I haven't dug much more than that; FWIW however, emacs 26.3 already
> applied font-lock-string-face to double-quoted strings when running
> (font-lock-ensure) in a fundamental buffer, so maybe the right fix
> belongs e.g. somewhere in font-lock-set-defaults?

Stefan, could you suggest what to do with font-lock-ensure
to not highlight double-quoted strings in fundamental-mode?