From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.ciao.gmane.io!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.bugs Subject: bug#39597: 27.0.60: M-x occur adds fontification to fundamental-mode Date: Tue, 18 Feb 2020 08:51:37 -0500 Message-ID: References: <87imk960qb.fsf@gmail.com> <8736b8eosv.fsf@mail.linkov.net> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="ciao.gmane.io:159.69.161.202"; logging-data="128976"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) Cc: 39597@debbugs.gnu.org, =?UTF-8?Q?K=C3=A9vin?= Le Gouguec To: Juri Linkov Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Tue Feb 18 14:52:16 2020 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1j43IN-000XPV-OR for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 18 Feb 2020 14:52:15 +0100 Original-Received: from localhost ([::1]:35320 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j43IM-0003iL-Qp for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 18 Feb 2020 08:52:14 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:50076) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j43IB-0003h7-SR for bug-gnu-emacs@gnu.org; Tue, 18 Feb 2020 08:52:05 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1j43IA-0003PD-L4 for bug-gnu-emacs@gnu.org; Tue, 18 Feb 2020 08:52:03 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:33726) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1j43IA-0003P8-Ha for bug-gnu-emacs@gnu.org; Tue, 18 Feb 2020 08:52:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1j43IA-0008M2-Gi for bug-gnu-emacs@gnu.org; Tue, 18 Feb 2020 08:52:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Stefan Monnier Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 18 Feb 2020 13:52:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 39597 X-GNU-PR-Package: emacs Original-Received: via spool by 39597-submit@debbugs.gnu.org id=B39597.158203391632088 (code B ref 39597); Tue, 18 Feb 2020 13:52:02 +0000 Original-Received: (at 39597) by debbugs.gnu.org; 18 Feb 2020 13:51:56 +0000 Original-Received: from localhost ([127.0.0.1]:39697 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1j43I4-0008LU-2h for submit@debbugs.gnu.org; Tue, 18 Feb 2020 08:51:56 -0500 Original-Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:2330) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1j43I1-0008LG-KF for 39597@debbugs.gnu.org; Tue, 18 Feb 2020 08:51:54 -0500 Original-Received: from pmg2.iro.umontreal.ca (localhost.localdomain [127.0.0.1]) by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id D3C4B8117E; Tue, 18 Feb 2020 08:51:47 -0500 (EST) Original-Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id 880588105C; Tue, 18 Feb 2020 08:51:38 -0500 (EST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1582033898; bh=dcPyNXtEb9mEcRu+SvK/cMax804WL1G5r3ACkSSdudE=; h=From:To:Cc:Subject:References:Date:In-Reply-To:From; b=g3VHNaEemRF5USwzBg33WdayKl1ZGJxPZc05kE03tmaqoRTgeMuObp4ps4QABPs1k HIB/9AJ82ADrfGFgFKiKBxjbNcLgaFgGMMcAH/iDXZIyuWyl3BT+rmEQqZms7zPdTL YpUjQ9yfBFHpEy7KdjUFRQb1t14vDJPLnFuBwZMztinZJqStkIt4uSSjCgo8v1D6Or RRou7GLEtUgWHKSMpwL2JOHCHCPFowAu6BgCwHyjUtKccQVtvtm4xi9/R5JbZS+7BD mZReAXifXavzC32q/9cLR6YgZhspxAHavWhfCZbn2GBXJwzWTFTdVgfxyhDmE9G603 YJR1QQfXcZR2A== Original-Received: from pastel (unknown [157.52.14.222]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 127CF1204B0; Tue, 18 Feb 2020 08:51:38 -0500 (EST) In-Reply-To: <8736b8eosv.fsf@mail.linkov.net> (Juri Linkov's message of "Tue, 18 Feb 2020 02:12:32 +0200") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.51.188.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:176186 Archived-At: Juri Linkov [2020-02-18 02:12:32] wrote: >> I think commit fb16313025 (2018-12-18T23:10:09Z!juri@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 > >> - 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? Maybe something like the patch below? I'm not sufficiently familiar with the design of `font-lock-specified-p` to be completely sure where the check should be placed; this is my best guess. Stefan diff --git a/lisp/font-lock.el b/lisp/font-lock.el index 438511b647..bf045d9d7e 100644 --- a/lisp/font-lock.el +++ b/lisp/font-lock.el @@ -1139,9 +1139,10 @@ font-lock-ensure "Make sure the region BEG...END has been fontified. If the region is not specified, it defaults to the entire accessible portion of the buffer." - (font-lock-set-defaults) - (funcall font-lock-ensure-function - (or beg (point-min)) (or end (point-max)))) + (when (font-lock-specified-p t) + (font-lock-set-defaults) + (funcall font-lock-ensure-function + (or beg (point-min)) (or end (point-max))))) (defun font-lock-default-fontify-buffer () "Fontify the whole buffer using `font-lock-fontify-region-function'."