From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel Subject: Re: master 7362554: Widen around c-font-lock-fontify-region. This fixes bug #38049. Date: Thu, 14 Nov 2019 13:51:05 -0500 Message-ID: References: <20191109144026.20810.76129@vcs0.savannah.gnu.org> <20191109144027.DDC3720927@vcs0.savannah.gnu.org> <38328d99-23c8-7ba7-a23d-e70ac0aab67a@yandex.ru> <20191111203445.GA5135@ACM> <7497e71d-bab6-fa04-bbc4-f52fadeda16d@yandex.ru> <20191113211936.GB4942@ACM> <6fc930a1-eb47-9e54-8752-8cf7ff041586@yandex.ru> <03042d05-2160-77c4-9abd-b0f13f638247@yandex.ru> <83woc24ets.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="59614"; mail-complaints-to="usenet@blaine.gmane.org" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux) Cc: acm@muc.de, emacs-devel@gnu.org, dgutov@yandex.ru To: Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu Nov 14 19:52:14 2019 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1iVKE0-000FJ3-Pz for ged-emacs-devel@m.gmane.org; Thu, 14 Nov 2019 19:52:13 +0100 Original-Received: from localhost ([::1]:60756 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iVKDz-0001EQ-Iu for ged-emacs-devel@m.gmane.org; Thu, 14 Nov 2019 13:52:11 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:50300) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iVKD9-0001CK-FP for emacs-devel@gnu.org; Thu, 14 Nov 2019 13:51:20 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iVKD8-0004TF-2s for emacs-devel@gnu.org; Thu, 14 Nov 2019 13:51:18 -0500 Original-Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:53066) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1iVKD3-0004Is-D1; Thu, 14 Nov 2019 13:51:15 -0500 Original-Received: from pmg2.iro.umontreal.ca (localhost.localdomain [127.0.0.1]) by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id D83D080D62; Thu, 14 Nov 2019 13:51:07 -0500 (EST) Original-Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id 88D8581155; Thu, 14 Nov 2019 13:51:06 -0500 (EST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1573757466; bh=3Ysy9RZABY8yFxTpj92kkmlVbOlEy7MYgcQQV0wADYU=; h=From:To:Cc:Subject:References:Date:In-Reply-To:From; b=Jo2QirSBdmEzrhdFFgfoLVX3ENwGQQExClIs+GlH0+PD2CCOAxqUNFwv4iR4yl5Ad 9EiAuI9vfW70hups1uVZSMkoGZ8HMk8HYNDYZEg1R9/2RDo80jAKEA0yX/zswg4bD5 sg4aG9EgKq5R+20nLpjl/5+V5FUC3njsISK1UOK5fyw3gbWhZ1kmOaPxAzv0oJN6dx Qo+5bQeUSQ9n93/ej8PPEh75rqh5cHda6HTtbgC40b5AxDkbEfXiQ3ayCL7NOruG6w YvnVBmJpdjZIJlRFU1OsYsEVxIx1RPPSRCdUnSBDFTDTnqYlpuHe2/cdQxy4zMRz4s nv+5tG9EhPl6Q== Original-Received: from lechazo (lechon.iro.umontreal.ca [132.204.27.242]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 7A96912038D; Thu, 14 Nov 2019 13:51:06 -0500 (EST) In-Reply-To: <83woc24ets.fsf@gnu.org> (Eli Zaretskii's message of "Thu, 14 Nov 2019 18:12:31 +0200") X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 132.204.25.50 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:242191 Archived-At: >> So, your earlier patch which added a call to `font-lock-ensure` was >> "more or less right", except that it should have used >> `jit-lock-ensure` (currently called `jit-lock-fontify-now`) and >> could have a comment explaining that vertical-motion will trigger >> jit-lock anyway so it's better to do it once beforehand on the whole >> region, not only so it can be done outside of the narrowing but also >> so it can be done more efficiently than one jit-lock-chunk-size at a >> time. > I'd like to solve this in CC mode instead, because the problem is there. I think the problem is wider than CC-mode. Maybe CC-mode is more susceptible to it or maybe it's just an accident that this was reported for CC-mode, but running font-lock (and syntax-propertize) within narrowing tends to be fiddly. > Fontifying arbitrary portions of the buffer to indirectly > avoid triggering the problem in CC mode sounds not TRT to me. `vertical-motion` *will* call `jit-lock-fontify-now` on all those buffer positions in any case, so while it is extra code I'd rather we don't need to write, it shouldn't have a negative impact on performance, quite the contrary. > In particular, what if the POINT-MIN..END chunk is still too large to > fontify in one go? AFAIK all uses of jit-lock are more efficient if they get fewer larger chunks than more smaller chunks. Stefan