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: Tree-sitter integration in python.el Date: Wed, 12 Oct 2022 15:55:21 -0700 Message-ID: <8182363C-3BB3-4741-B916-09C78971CE30@gmail.com> 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 (Mac OS X Mail 16.0 \(3696.120.41.1.1\)) 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="7917"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Eli Zaretskii , Augusto Stoffel , orontee@gmail.com, emacs-devel@gnu.org To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Thu Oct 13 00:56:47 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 1oiked-0001mU-95 for ged-emacs-devel@m.gmane-mx.org; Thu, 13 Oct 2022 00:56:47 +0200 Original-Received: from localhost ([::1]:51850 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oikeb-0001dH-Va for ged-emacs-devel@m.gmane-mx.org; Wed, 12 Oct 2022 18:56:45 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:37848) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oikdO-0000aD-By for emacs-devel@gnu.org; Wed, 12 Oct 2022 18:55:31 -0400 Original-Received: from mail-pj1-x1032.google.com ([2607:f8b0:4864:20::1032]:56185) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oikdI-0008VY-T6; Wed, 12 Oct 2022 18:55:29 -0400 Original-Received: by mail-pj1-x1032.google.com with SMTP id gf8so348103pjb.5; Wed, 12 Oct 2022 15:55:24 -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=pcIqFA7U0kSjynfSmnjy0c4kwWrDm3alaIVbDfOALCg=; b=V7WjTjSq+EjC5iYUhTBSIPa6OjuHCcMc9pVpfDX2B6Nye0UUAMO1g0/73h7ChDznIP UbpDu9Ikt7D/qpoNUk3wN+nCviOwsssG786VJGM9mmBv8iO1bN0L9Tgx0T0BwNwUOVWD 71tl3WzsXXuSslOok5GSGQk12AdIUPYZR2sBgYBhJMGtIVtBtC89CxuMp2RQvWy90K2A /IkZw3il4fIke0N8a0tXsiw08AsculeBDGBz33UagcKmYf64VuZXeJnXo2KX/mg+SrtD AiRid5C/ne/wuQSGfeUHJ4VNVLi2oLTmQ4n3SAZQcxvTPvsh0WJPYQBRkZXEnzhGG2oY FEag== 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=pcIqFA7U0kSjynfSmnjy0c4kwWrDm3alaIVbDfOALCg=; b=BkQnKJ2JqFmMl9KARb8jsFG/+mSCWMEcplPYPWBqapZvzOEEKs6Wnt+9pWuo9gc6yy HxWiu69kfIb/gJ3KtJ/hcJ0XKj2puMnZTPc+XyrR6SO+weM1oNZjy29FnMNIBqwEQt9W duyGN/UROrgM1g0rLFrESLA8VEhZD1POqOTQfzm6qRbmdMII9pAL6qVDw3AkgWQp4vjD +EJ6Oxu0g6oQK/33FWaft/XuA8u6jW+J5JCrH76QIeGMeJ+g5u7RqeGjhsT4tHbUfIKD Fc6vVyEo784FCFBPHcSPRb7NptZI6eDSYf7nR2jxPcpWNO8a4pYEezbdXGHr2VljZI2M dmnA== X-Gm-Message-State: ACrzQf1Z/RQezyA5E7uE3gXAbwbDV6AZY8qRklbVj3Wn+dRN4u2753eC Ngw8wnq5sB4vTqzIs/kp6qs= X-Google-Smtp-Source: AMsMyM6D9J+YlmaOW3OMaduzKWd0Tky/QEYRPdC/rHv6roer4RN+0r+2kFyGjyHdhmd+0oIa6WLEww== X-Received: by 2002:a17:90b:2242:b0:20d:a2be:95a4 with SMTP id hk2-20020a17090b224200b0020da2be95a4mr1198462pjb.159.1665615323085; Wed, 12 Oct 2022 15:55:23 -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 u13-20020a170903124d00b0017f80305239sm11262393plh.136.2022.10.12.15.55.22 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 12 Oct 2022 15:55:22 -0700 (PDT) In-Reply-To: X-Mailer: Apple Mail (2.3696.120.41.1.1) Received-SPF: pass client-ip=2607:f8b0:4864:20::1032; envelope-from=casouri@gmail.com; helo=mail-pj1-x1032.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:297638 Archived-At: > On Oct 12, 2022, at 10:52 AM, Stefan Monnier = wrote: >=20 >> 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. >=20 > 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. >=20 >> 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= create >> a gazillion variables. But WDYT of the general design? >=20 > 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. >=20 > And I would prefer not to include :level in the rules themselves and > instead rely on a separate mapping between features and levels. Sounds good! I can do that. Yuan=