From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Trey Peacock Newsgroups: gmane.emacs.devel Subject: Re: Disable tree-sitter font-locking for smaller ranges Date: Tue, 18 Oct 2022 01:23:09 +0000 Message-ID: <87k04ykjrc.fsf@treypeacock.com> 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="24689"; mail-complaints-to="usenet@ciao.gmane.io" Cc: emacs-devel@gnu.org To: Yuan Fu , Theodor Thornhill Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Tue Oct 18 03:24:56 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 1okbLi-00065C-Uf for ged-emacs-devel@m.gmane-mx.org; Tue, 18 Oct 2022 03:24:56 +0200 Original-Received: from localhost ([::1]:38594 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1okbLh-0001DV-FP for ged-emacs-devel@m.gmane-mx.org; Mon, 17 Oct 2022 21:24:53 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:51538) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1okbKO-0000UX-KE for emacs-devel@gnu.org; Mon, 17 Oct 2022 21:23:32 -0400 Original-Received: from mail-4018.proton.ch ([185.70.40.18]:54109) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1okbKI-0005Z5-Cu for emacs-devel@gnu.org; Mon, 17 Oct 2022 21:23:28 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=treypeacock.com; s=protonmail3; t=1666056200; x=1666315400; bh=0uoaC15kzlRttjDCM5PbsHZCZDyKDqlE22GgVtSwvIM=; h=Date:To:From:Cc:Subject:Message-ID:In-Reply-To:References: Feedback-ID:From:To:Cc:Date:Subject:Reply-To:Feedback-ID: Message-ID; b=SgWNfiBGR79jXywZyIxg+1Xnb+o1vFZPFbHAqrF5/TPi/4Zl2b9vU94HfxORzE6rE 2yk/Id075FUwCK2EFh5LS//HzHrd3yZT9hA1zCUUVl1VReqXF/TSchoYQUgbOlGG+R l/UuJRmtC4P5B6al2v8fueGOJsJBHngWeR1CFjNZrfCGS2r9lu7fOKuO+vaAIDMjBd bjr7rVEK8BabAKGsinxDZdSlGK6n+5Say8+n1jldYSLdmqNBwaG1BUQchUKoL/dm3t 1zPYXok19oqcowN9HNZXP3LLUeElQliqhE3r0PR/OaFKZhtyhZRDWIzH9aJc70khov lbeudWwwKMbdg== In-Reply-To: <1001F2D8-5976-4E39-BC7B-9EF2A2714B61@gmail.com> Feedback-ID: 17020329:user:proton Received-SPF: pass client-ip=185.70.40.18; envelope-from=gpg@treypeacock.com; helo=mail-4018.proton.ch X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 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, 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:298002 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 > If it's useful, I believe the reason why the queries you were using didn't work was because you were using the alternation which only allows for selecting a single option. This should work, regardless of the order: (template_substitution "${" @font-lock-constant-face "}" @font-lock-constant-face) @default (escape_sequence) @font-lock-constant-face (template_string) @font-lock-string-face However, I am unsure how to address potentially nested template substitutions. Perhaps a function could assist in that. Trey