From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Stefan Monnier via "Bug reports for GNU Emacs, the Swiss army knife of text editors" Newsgroups: gmane.emacs.bugs Subject: bug#71345: Feature: unleash font-lock's secret weapon; handle Qfontified = non-nil Date: Mon, 03 Jun 2024 21:44:36 -0400 Message-ID: References: <8A929E16-AF10-4D2B-AD71-AEAD4435F016@gmail.com> <1F2B8726-7594-494F-AB9D-08C48B7BCC43@gmail.com> Reply-To: Stefan Monnier Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="1904"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: dmitry@gutov.dev, 71345@debbugs.gnu.org To: JD Smith Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Tue Jun 04 03:46:06 2024 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 1sEJFV-0000DF-Vy for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 04 Jun 2024 03:46:06 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sEJFH-0002fR-K6; Mon, 03 Jun 2024 21:45:51 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sEJFF-0002aD-9Y for bug-gnu-emacs@gnu.org; Mon, 03 Jun 2024 21:45:49 -0400 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sEJFF-00087K-0t for bug-gnu-emacs@gnu.org; Mon, 03 Jun 2024 21:45:49 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1sEJFS-0002qh-5H for bug-gnu-emacs@gnu.org; Mon, 03 Jun 2024 21:46:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Stefan Monnier Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 04 Jun 2024 01:46:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 71345 X-GNU-PR-Package: emacs X-Debbugs-Original-Cc: Dmitry Gutov , bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.171746550310844 (code B ref -1); Tue, 04 Jun 2024 01:46:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 4 Jun 2024 01:45:03 +0000 Original-Received: from localhost ([127.0.0.1]:56028 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sEJEU-0002oq-UU for submit@debbugs.gnu.org; Mon, 03 Jun 2024 21:45:03 -0400 Original-Received: from lists.gnu.org ([209.51.188.17]:34170) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sEJET-0002oI-Cj for submit@debbugs.gnu.org; Mon, 03 Jun 2024 21:45:02 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sEJEF-0002N7-SY for bug-gnu-emacs@gnu.org; Mon, 03 Jun 2024 21:44:48 -0400 Original-Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sEJEE-0007ky-56 for bug-gnu-emacs@gnu.org; Mon, 03 Jun 2024 21:44:47 -0400 Original-Received: from pmg3.iro.umontreal.ca (localhost [127.0.0.1]) by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id 59112444AD4; Mon, 3 Jun 2024 21:44:39 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1717465477; bh=IWpA4kMrmDk/Xhwe3b+R/ZGANlwSaVoYhzPfAGXpYqY=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=V3tFj/UXPSaqidWQKzIBJWXshdDkHbJaDncc6lMVmdbfHjeyG4muts+JatKOTHqlA G8Lc2womnV/3Dbi8TaS3+Br148AybkbQXn146O56dNrbgzhbeCzseVuH6XOldztXXq NIEEj8atMnL5tVmTTsD92p21MWbN+1dnWhj5J0/buvZabnvBKoWsP80mt672knH8fU TFXRTgAdJcAv2+hk2NvL/27R/5AbMvQPSkpj9W6RIV1FHgQBrC4z/i16Mx4YIb0URj 1uNT1r5QWtc/efTdB2uas67vk3pDS8ebbjT+wAck4qxDX+cKCgpqbKgjmAW7neEBMC NpXOR6bZAIhQg== Original-Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id CA40F444ACF; Mon, 3 Jun 2024 21:44:37 -0400 (EDT) Original-Received: from pastel (unknown [24.140.236.196]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 6281F120656; Mon, 3 Jun 2024 21:44:37 -0400 (EDT) In-Reply-To: <1F2B8726-7594-494F-AB9D-08C48B7BCC43@gmail.com> (JD Smith's message of "Mon, 3 Jun 2024 17:14:49 -0400") Received-SPF: pass client-ip=132.204.25.50; envelope-from=monnier@iro.umontreal.ca; helo=mailscanner.iro.umontreal.ca X-Spam_score_int: -42 X-Spam_score: -4.3 X-Spam_bar: ---- X-Spam_report: (-4.3 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list 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-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:286502 Archived-At: > Thanks. Very interesting approach, recycling the existing Qfontified > handler. I wonder though, if you have several different unrelated functions > calling `jit-lock-flush' with different FONTIFICATION-FUNCTION's prior to > jit-lock-fontify-now running on a region, won't they step on each other? Not if `jit-lock.el` handles it correctly, no. > I.e it seems that you would need to look for existing > jit-lock-already-fontified+fontified=nil properties over the region > mentioned in jit-lock-flush and subtract the passed FONTIFICATION-FUNCTION > from the various values already found there. Yes, of course. > Of course you'd also need to handle the case where you "subtract it > all the way to nil". I don't think you'd need to do anything special for this case. > That starts to sound like a lot of property slinging, which might even > dominate the work done. Indeed, this amount of work could become significant. It's my main worry, but I don't have a clear feel for how serious it would be in practice. We could try and unify `fontified` and `jit-lock-already-fontified` by having a `fontified-done-value` variable and making the redisplay call jit-lock whenever `fontified` has a value that's not-eq from `fontified-done-value`. So jit-lock would set `fontified-done-value` to the list of backends. > I imagine that the functions may also need a way to opt-out of "deferred > contextual refontification", for example if they add some other > properties/overlays orthogonal to face. `jit-lock.el` already has that info (it's the second arg to `jit-lock-register`), but it currently doesn't keep track of it individually for each backend. Stefan