From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.devel Subject: Re: master 7362554: Widen around c-font-lock-fontify-region. This fixes bug #38049. Date: Fri, 15 Nov 2019 11:36:08 +0200 Message-ID: <83r22932if.fsf@gnu.org> 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> <83h836466w.fsf@gnu.org> Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="203416"; mail-complaints-to="usenet@blaine.gmane.org" Cc: acm@muc.de, emacs-devel@gnu.org, dgutov@yandex.ru To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Nov 15 10:37: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 1iVY2T-000qlU-TJ for ged-emacs-devel@m.gmane.org; Fri, 15 Nov 2019 10:37:14 +0100 Original-Received: from localhost ([::1]:37034 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iVY2S-0004Kg-NL for ged-emacs-devel@m.gmane.org; Fri, 15 Nov 2019 04:37:12 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:51115) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iVY1f-0003zl-Sv for emacs-devel@gnu.org; Fri, 15 Nov 2019 04:36:24 -0500 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]:41850) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1iVY1f-00010f-3m; Fri, 15 Nov 2019 04:36:23 -0500 Original-Received: from [176.228.60.248] (port=4854 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1iVY1e-0002xw-Iu; Fri, 15 Nov 2019 04:36:22 -0500 In-reply-to: (message from Stefan Monnier on Thu, 14 Nov 2019 16:29:38 -0500) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] 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:242224 Archived-At: > From: Stefan Monnier > Cc: dgutov@yandex.ru, acm@muc.de, emacs-devel@gnu.org > Date: Thu, 14 Nov 2019 16:29:38 -0500 > > >> 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. > > I'm also okay with fixing it in font-lock or jit-lock. But doing that > > inside reposition.el makes no sense to me. > > IIUC this can't be fixed in font-lock or jit-lock. Why not? > It can only be fixed "upstream" (e.g. in repos-count-screen-lines) > or "downstream" (in the particular major mode's rules). I believe my original suggestion was to fix this in CC Mode, but you seemed to disagree. So now you do agree with that? > > So we are going to do such changes in every application that calls > > vertical-motion, directly or indirectly? > > I'd phrase it as "this would need to be done in any narrowing > which changes point-min and internally can trigger jit-lock". That's any number of places out there, and I don't see how could they be identified. > The fix should not be "where we can do vertical-motion (and friends)" > but "where we narrow (and later trigger jit-lock)". Whether that means > "fix their callers as well" depends on what it is that owns the "their > callers": yes it would be in the functions that call (directly or not) > `vertical-motion` (and friends) but in the functions that call > those functions. Sorry, I don't think this is practical. I think fixing this in CC Mode is a much better alternative. > In any case, changing the narrow-to-region so it doesn't change > point-min is the right fix. Adding a call to `jit-lock-fontify-now` is > another but worse way to fix it. I don't think any of these two ways were proposed as patches, so I don't think I understand well enough what are those changes you prefer here. > Adding that call should be harmless and could be beneficial for > performance, but I personally wouldn't do it (it can also be harmful > for performance in the case where the text has already been jit-locked > in which case it won't do anything but will still take a bit of time to > do it). What is "that call" in this context?