From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Yuan Fu Newsgroups: gmane.emacs.devel Subject: Re: Disable tree-sitter font-locking for smaller ranges Date: Mon, 17 Oct 2022 17:20:02 -0700 Message-ID: <5759ADC4-835D-431C-9E68-CCAD1D6B8274@gmail.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> <87tu42zt0d.fsf@thornhill.no> <87o7uazpat.fsf@thornhill.no> Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3696.120.41.1.1\)) Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="14971"; mail-complaints-to="usenet@ciao.gmane.io" Cc: emacs-devel@gnu.org To: Theodor Thornhill Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Tue Oct 18 02:21:13 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 1okaM5-0003dD-6s for ged-emacs-devel@m.gmane-mx.org; Tue, 18 Oct 2022 02:21:13 +0200 Original-Received: from localhost ([::1]:50580 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1okaM3-0008Nc-PS for ged-emacs-devel@m.gmane-mx.org; Mon, 17 Oct 2022 20:21:11 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:38938) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1okaL2-0007bg-C2 for emacs-devel@gnu.org; Mon, 17 Oct 2022 20:20:08 -0400 Original-Received: from mail-pl1-x62a.google.com ([2607:f8b0:4864:20::62a]:35549) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1okaL0-0004iM-Mr for emacs-devel@gnu.org; Mon, 17 Oct 2022 20:20:08 -0400 Original-Received: by mail-pl1-x62a.google.com with SMTP id h2so4928282plb.2 for ; Mon, 17 Oct 2022 17:20:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=D6K+S+VhwvQxkAGa6c38dPgd++g3tmXAAaMrc5y24s8=; b=Rsm3W8HJM3nLRcSyKTGPhYSoopUr+xCXwvOcDKerDdYfF7a2qaHeJ866fSmKldRv3A IiFgERo6QrO1K/z2dMxehYrzyTfA9B5O0bj2yHpS/s9RVe8eml1SQhgI7IkbSFBNAOzj xQP/Xeh3xLkgIw2up7qrEoTOL3WVkPWdPbWdAzDJJiRT04M0Hiaw9hvT0mUETDD5H9OM xoBTpydxdibOw7bSFt8dvkFfGhoVT6rADTbcm5Gqi/non9Ti0kreS+DgiZ5Ku1Z7Q80J kXJtPquaB8RnDaiIOf26qxTBzRvQEPi/5tFClJ0vpMK3PqQfmh8Ppp3oHe2gA8iEbGAa xOTA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=D6K+S+VhwvQxkAGa6c38dPgd++g3tmXAAaMrc5y24s8=; b=nOCTOyRCnArKd5JwNnMR/Jx/pClrscRI1Z9FSAqQLR07SRqdzOo7kmejgQZNNKKQOh KDtT3By/GRzNzDxx+65lRHd00e+jEK7u4CaMvPu2lRH8wAqU5GYmBSJZkPY31QNhbrn+ CGtFZDoQWH2bC8NLcaCkzxjPOg+QD4voUg2nUT6lAWC866wlBwLyx67GHm6WOPIB6kFd cvlOWHfJ8YL+CuerglJcuTGDU3VKXtYTrIiCSXBpbtjBd2kFKkWkaT/GIl2BZOYRunpT h+qXYOBCPHb+7Dyw9EWibM//tEXoSmSlCD54hQf1NcOdlygEBfMFesSOX/zPPRDAQMXM dxZg== X-Gm-Message-State: ACrzQf2gVYB2KF3aJ5LvswTmB9haUl4oitaZ2MBq2aLXaofdZIEgjO1V ZVV01jjIZJp6YfoBurpecDY= X-Google-Smtp-Source: AMsMyM6PEd7i1u3N9fzq59uG10163j41jIjlDMO4p7UdQydlPsscSDZDawnJj2o1fXhk8Y1E1hmoHQ== X-Received: by 2002:a17:902:bd98:b0:182:631b:7dd5 with SMTP id q24-20020a170902bd9800b00182631b7dd5mr192787pls.165.1666052404737; Mon, 17 Oct 2022 17:20:04 -0700 (PDT) Original-Received: from smtpclient.apple (cpe-172-117-161-177.socal.res.rr.com. [172.117.161.177]) by smtp.gmail.com with ESMTPSA id z14-20020aa79e4e000000b005631a40a00bsm7683927pfq.139.2022.10.17.17.20.03 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 17 Oct 2022 17:20:03 -0700 (PDT) In-Reply-To: <87o7uazpat.fsf@thornhill.no> X-Mailer: Apple Mail (2.3696.120.41.1.1) Received-SPF: pass client-ip=2607:f8b0:4864:20::62a; envelope-from=casouri@gmail.com; helo=mail-pl1-x62a.google.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, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=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:298001 Archived-At: > On Oct 17, 2022, at 4:02 AM, Theodor Thornhill = wrote: >=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). >>>=20 >>=20 >> I will do that promptly and attach patches for ts-mode and js-mode to >> this thread. >>=20 >> Theo >=20 >=20 > See attached patch :-) Thanks! I think you have a bit of misunderstanding of the :feature flag. = 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. And you should set = treesit-font-lock-feature-list to (setq treesit-font-lock-feature-list '((minimum) (moderate) (full))) Yuan=