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: Tue, 18 Oct 2022 07:04:02 +0200 Message-ID: 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> <87tu42zt0d.fsf@thornhill.no> <87o7uazpat.fsf@thornhill.no> <5759ADC4-835D-431C-9E68-CCAD1D6B8274@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="37720"; 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 Tue Oct 18 07:06: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 1okenu-0009hI-4H for ged-emacs-devel@m.gmane-mx.org; Tue, 18 Oct 2022 07:06:14 +0200 Original-Received: from localhost ([::1]:34516 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1okens-0007r5-K0 for ged-emacs-devel@m.gmane-mx.org; Tue, 18 Oct 2022 01:06:12 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:49478) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1okemd-00073Z-4L for emacs-devel@gnu.org; Tue, 18 Oct 2022 01:04:55 -0400 Original-Received: from out2.migadu.com ([188.165.223.204]:12555) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1okema-0005Qn-WA for emacs-devel@gnu.org; Tue, 18 Oct 2022 01:04:54 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=thornhill.no; s=key1; t=1666069489; 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=tSq9rObcc3Hgo1r4JlHvu+0Pzdrh+Watm3gUypo252U=; b=MVto7TEmM5+d+7Y8pqGwGwUuIW/JO+MNEg3WI8KphrESmNSL6WogQ/UXkz2h+wuN5p2kjk XNhjiv8dm64Qa/pSVtKRRpgZM52rN0ZHQniXH+aqA9x7yD5G/exXtnx1DJ0vpYLvaxYeg7 j1T/4ZmYtArwmC25yxNxGx/ijao6NTNXiGg0hU8xs7ZQLdPfHVe7XAlbhhRUv/X3rZKjZs U7K+Alw0ovbJyxSwyf64LL8p8LU/MctOWCbBUFSd+Po3FWVR4jkFBnLvIfNK8CYHxsHOPS fZ7lIwaJwjM9m/sdzaWS3QA5wlr9HtP99MrN89V6mQihrA1hynKBCCFVtKrbqA== X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. In-Reply-To: <5759ADC4-835D-431C-9E68-CCAD1D6B8274@gmail.com> X-Migadu-Flow: FLOW_OUT Received-SPF: pass client-ip=188.165.223.204; envelope-from=theo@thornhill.no; helo=out2.migadu.com 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:298009 Archived-At: On 18 October 2022 02:20:02 CEST, Yuan Fu wrote: > > >> On Oct 17, 2022, at 4:02 AM, Theodor Thornhill wr= ote: >>=20 >>>> 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)=2E >>>>=20 >>>=20 >>> I will do that promptly and attach patches for ts-mode and js-mode to >>> this thread=2E >>>=20 >>> Theo >>=20 >>=20 >> See attached patch :-) > >Thanks! I think you have a bit of misunderstanding of the :feature flag= =2E You should only need to change > >(defvar xxx-font-lock-settings > (treesit-font-lock-rules > :language 'xxx > '(1111111111111 > 2222222222222 > 3333333333333))) > >to > >(defvar xxx-font-lock-settings > (treesit-font-lock-rules > :language 'xxx > :feature 'minimum > '(1111111111111) > :language 'xxx > :feature 'moderate > '(2222222222222) > :language 'xxx > :feature 'full > '(3333333333333))) > >Ie, no need to create separate variables=2E And you should set treesit-fo= nt-lock-feature-list to > >(setq treesit-font-lock-feature-list > '((minimum) (moderate) (full))) > >Yuan Oh, right, thanks! The separate variables was more for readability, but I can change that bac= k :) Theo