From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Theodor Thornhill Newsgroups: gmane.emacs.devel Subject: Re: Disable tree-sitter font-locking for smaller ranges Date: Mon, 17 Oct 2022 11:41:54 +0200 Message-ID: <87tu42zt0d.fsf@thornhill.no> References: <877d109hz1.fsf@thornhill.no> <672FF8D1-E5FB-44D8-8E6D-38EB94843B3B@gmail.com> <543ACCB7-9EE3-41AF-B1E3-704B6E6BC085@gmail.com> <87o7ub0xjs.fsf@thornhill.no> <1001F2D8-5976-4E39-BC7B-9EF2A2714B61@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="13974"; mail-complaints-to="usenet@ciao.gmane.io" Cc: emacs-devel@gnu.org To: Yuan Fu Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Mon Oct 17 11:52:14 2022 Return-path: Envelope-to: ged-emacs-devel@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 1okMn7-0003Nx-BH for ged-emacs-devel@m.gmane-mx.org; Mon, 17 Oct 2022 11:52:13 +0200 Original-Received: from localhost ([::1]:34914 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1okMn6-00051S-4V for ged-emacs-devel@m.gmane-mx.org; Mon, 17 Oct 2022 05:52:12 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:60638) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1okMdH-0006hU-ES for emacs-devel@gnu.org; Mon, 17 Oct 2022 05:42:04 -0400 Original-Received: from out0.migadu.com ([94.23.1.103]:27145) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1okMdD-0005M3-P8 for emacs-devel@gnu.org; Mon, 17 Oct 2022 05:42:01 -0400 X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=thornhill.no; s=key1; t=1665999716; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=tMGltbQhGvMKVkF/HV/feZap03yNeV6r3AqKTl8A0jo=; b=PNN1kGukBI4o2wpISJvFd0MjF6AbCuxyYCafgYSpgOzICEmWetp/jkhWW+QZ8+CJSB9ONE BIDijXjbjV8JTRj+eGrwKsk8Bsd5o4AM2qfb4pM8b6tu3V7cqONHlc2RN4NKiq5AJuDAmI BTPZNRo/awvOc+eehSD4zIKdJ4YJRewUPB/LMf+y3S0Dv+kDTzWB7fHMDx83ZzVoKf9PlK fVPBE/FT9kvMrjbB3dWQHvg1OOsytqDnBSI4PoFJuIQq0nZd/PAuGjexjDSmM7dd2eIGtM yEfqI7Dt2jSbewjJaugFConvFIZWbuYvw3wRDZ+gfPTvLCWxNytPPbPfq6Jb4A== In-Reply-To: <1001F2D8-5976-4E39-BC7B-9EF2A2714B61@gmail.com> X-Migadu-Flow: FLOW_OUT Received-SPF: pass client-ip=94.23.1.103; envelope-from=theo@thornhill.no; helo=out0.migadu.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 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-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:297945 Archived-At: Yuan Fu writes: > > Actually, thinking more of it, it working relies on the exact order of wh= ich these rules are applied: > 1. Outer template_string > 2. Outer template_substitution > 3. Inner template_string > 4. Inner template_substitution That's correct. > > Relying on such un-guaranteed fact is a bit uncomfortable, so I just > wrote a function that did what you suggested initially: to fontify > parts of template_string that=E2=80=99s not a template_substitution. WDYT= ? (I > just pushed the change.) > I agree! The change looks good to me. Is there any change in performance doing this? I'm not yet 100% on the inner workings, but if this would slow things down that wouldn't be so nice. > BTW, if you have time and energy, could you look into separating the > queries into roughly three levels: minimum, moderate, and full > fontification, and mark each with the new :feature flag? Or even > better, separate them into different features (as suggested in the > docstring of treesit-font-lock-feature-list). > I will do that promptly and attach patches for ts-mode and js-mode to this thread. Theo