From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel Subject: Re: Tree-sitter integration in python.el Date: Wed, 12 Oct 2022 13:52:15 -0400 Message-ID: References: <3A68545C-2E40-4BB4-8563-8041A5452634@gmail.com> <87y1twlr0v.fsf@gmail.com> <83czb8ycpo.fsf@gnu.org> <87tu4klfcw.fsf@gmail.com> <87ill0le20.fsf@gmail.com> <87y1ttfmj8.fsf@gmail.com> <19950F30-F4DB-4CE4-9257-24DA39594669@gmail.com> <87czb47jya.fsf@gmail.com> <87wn9c7xxd.fsf@gmail.com> <83wn9altdu.fsf@gnu.org> 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="35660"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux) Cc: Eli Zaretskii , arstoffel@gmail.com, orontee@gmail.com, emacs-devel@gnu.org To: Yuan Fu Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Wed Oct 12 19:53:36 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 1oifvD-00094S-Uk for ged-emacs-devel@m.gmane-mx.org; Wed, 12 Oct 2022 19:53:36 +0200 Original-Received: from localhost ([::1]:46496 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oifvC-0008JD-QE for ged-emacs-devel@m.gmane-mx.org; Wed, 12 Oct 2022 13:53:34 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:45452) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oifu5-0007D5-Ot for emacs-devel@gnu.org; Wed, 12 Oct 2022 13:52:25 -0400 Original-Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:64672) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oifu1-0005b8-1V; Wed, 12 Oct 2022 13:52:24 -0400 Original-Received: from pmg2.iro.umontreal.ca (localhost.localdomain [127.0.0.1]) by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id 80B59807C3; Wed, 12 Oct 2022 13:52:18 -0400 (EDT) Original-Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id CEB75804FC; Wed, 12 Oct 2022 13:52:16 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1665597136; bh=OTDV9BynrlK3rV1U6xUxMl9DD6raYnm19cAWRBoppHo=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=Z98M4cdL9clcvMo+V5YgDqrHb4+yT8yOPoik2c4oUrL+M2C8plUln7yuCQXG50N7p 8xWNFRBhqOtWPFK21r7YGQsGthIQeUP2jgLX1gCviAtfKa5A2XpSH3Z7BCy5Dxj+/A q73F81oNf3zAyI5plL3nkTKMUNnodNLOtti7SmrhkHypm4zO+eC+HnbOVAlG4Zk237 4O2h+p8gaeXUniFr1uh1QmJxR9dcXpuGLBO0AlT/m76VYnT7yV1NfxDr/dgnRh9PtG 1tHpuBMIpkNZugKHFiUzE0Xw2L1EZoa1vntRilDnUS/qSOl8X6AT/NhVW7SdRoRZdB 7vCilUy8Yxc7w== Original-Received: from lechazo (lechon.iro.umontreal.ca [132.204.27.242]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id BB910120455; Wed, 12 Oct 2022 13:52:16 -0400 (EDT) In-Reply-To: (Yuan Fu's message of "Tue, 11 Oct 2022 22:04:38 -0700") 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 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:297625 Archived-At: > One problem I can see is that the same level could give very different > busyness across modes. That would defeat the purpose of having a single > setting. Say mode 1 has (A B C D E F G H I), where ABC are very basic, DEF > moderate, and GHI fancy, mode 2 has (A B C D E F G), A basic, BCDEF > moderate, G fancy. Then 80 would give a fancy font-lock in mode 1 and > a moderate font-lock in mode 2. You get the idea. Yup. We could be more explicit, then, e.g. use things like ((A B C) (D E F) (G H I)) for the first and ((A) (B C D E F) (G)) for the second. > Currently tree-sitter supports both :level and :toggle. When defining > queries you can say :toggle python-fontify-types, and python-fontify-types > can control this query. :level would be the global rough settings, :toggle > would be the local, fine-grained setting. Instead of variables, :toggle > could be changed to use symbols as you suggested, so it doesn=E2=80=99t c= reate > a gazillion variables. But WDYT of the general design? I definitely prefer symbols to variables: this way they can use their own namespace and don't need the long package prefix and can be shared/reused between different modes without conflict. And I would prefer not to include :level in the rules themselves and instead rely on a separate mapping between features and levels. Stefan