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.bugs Subject: bug#60983: 29.0.60; Tree-sitter user-level control Date: Wed, 25 Jan 2023 23:56:03 -0800 Message-ID: <3CCA0C80-F37A-4F4F-9556-F6C7610762F9@gmail.com> References: <83tu0kkuqo.fsf@gnu.org> Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3731.300.101.1.3\)) 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="34877"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Eli Zaretskii , 60983@debbugs.gnu.org To: Theodor Thornhill Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu Jan 26 08:57:35 2023 Return-path: Envelope-to: geb-bug-gnu-emacs@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 1pKx8X-0008rT-32 for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 26 Jan 2023 08:57:33 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pKx8K-0007KR-L7; Thu, 26 Jan 2023 02:57:20 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pKx8D-0007Hg-UY for bug-gnu-emacs@gnu.org; Thu, 26 Jan 2023 02:57:13 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pKx82-0003Ze-LH for bug-gnu-emacs@gnu.org; Thu, 26 Jan 2023 02:57:12 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1pKx82-0005xG-Bs for bug-gnu-emacs@gnu.org; Thu, 26 Jan 2023 02:57:02 -0500 X-Loop: help-debbugs@gnu.org In-Reply-To: <83tu0kkuqo.fsf@gnu.org> Resent-From: Yuan Fu Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 26 Jan 2023 07:57:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 60983 X-GNU-PR-Package: emacs Original-Received: via spool by 60983-submit@debbugs.gnu.org id=B60983.167471978422842 (code B ref 60983); Thu, 26 Jan 2023 07:57:02 +0000 Original-Received: (at 60983) by debbugs.gnu.org; 26 Jan 2023 07:56:24 +0000 Original-Received: from localhost ([127.0.0.1]:60554 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pKx7P-0005wM-Lq for submit@debbugs.gnu.org; Thu, 26 Jan 2023 02:56:24 -0500 Original-Received: from mail-pf1-f181.google.com ([209.85.210.181]:41969) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pKx7M-0005w7-TN for 60983@debbugs.gnu.org; Thu, 26 Jan 2023 02:56:21 -0500 Original-Received: by mail-pf1-f181.google.com with SMTP id c124so616401pfb.8 for <60983@debbugs.gnu.org>; Wed, 25 Jan 2023 23:56:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=to:cc:date:message-id:subject:mime-version :content-transfer-encoding:from:from:to:cc:subject:date:message-id :reply-to; bh=gex9imciShvoK68Akjd5F8bPTq2X5E14fvZ4nDxmpog=; b=jIpZN4+7jnh9rKoDqf1BmSHx9vrfPMvknZbgvv/fGgGe4/lc59RoBJwzcBH/gDd/gZ vHL/jTT9C1dWhs93SUrV7eXW0NJk91Hm+z+5rL4l4no4W+TlpSeX5PtAVXjDWMFQGQLM 9tvgXiroYFmXkKN9Q7YddzbTdenJ2PccuB0TKIAt/1dG9WLAO9boJNifo4LDdRRgRyvg 0IbTCpFlMCdgdnmpbDd7ntan1r5SNl942Q8tsGfVc357RRuCsMKa8rvythi1tqMZeWAN zGwHwFPBg2opacvpHxsUi3FZ0zaa+DRfCjcbYxSDPOm3Nhd0S4I3jGO1w2rNDYbtCuJ8 Vciw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=to:cc:date:message-id:subject:mime-version :content-transfer-encoding:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=gex9imciShvoK68Akjd5F8bPTq2X5E14fvZ4nDxmpog=; b=RLp9TqYQ/s4f5UAQ+4V6qrzrmr4BXsQTD7dYCY2umyRsb1P1Rk+yjrkVG7ALs4SLNc aqn0WFqK8SBt5A29iDFipwbikoeZLvfScjCV0/+gVjk/NAzXMTXyZuh3aM5wZxyw0DA2 fEwKZ6k5bGEzjMzuBQ36GT6z4pMsw381lc4WkxevPNa6V8n0FhLt4cyCVawtvErtXVXY JMIlL+MQ2XX9cjJxVlt3AvMaqOmdKo0llGedpDTkY2LDudrEeBi3CxxIFC9dUOlnREvv 2FfZ4yL8mPKyrrjuY6s3AdWdpOGYruMI2iMerSIRIeqPEN/FiCj/rGNrNdwkSIHqi+Mb Gmlw== X-Gm-Message-State: AFqh2kok/kBr/XKGY90ApWlblZ5RmWCQ4Bn+fUZEY93T4Gamf0DO6F2s 6ooycCL9KDgyQcyESk2fNe7KPXgNkFs= X-Google-Smtp-Source: AMrXdXv8WbnWSzcBh5+A/choMxbZyHlw+oF6bzEYiRdogrDYfwDSSeUOn3a2UnCcDdhY97B6uK8H4Q== X-Received: by 2002:a05:6a00:4515:b0:575:d06d:1bfa with SMTP id cw21-20020a056a00451500b00575d06d1bfamr34675167pfb.2.1674719775198; Wed, 25 Jan 2023 23:56:15 -0800 (PST) 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 186-20020a6216c3000000b0058dd9c46a8csm301673pfw.64.2023.01.25.23.56.14 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 25 Jan 2023 23:56:14 -0800 (PST) X-Mailer: Apple Mail (2.3731.300.101.1.3) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:254186 Archived-At: Theodor Thornhill writes: > Eli Zaretskii writes: > >>> Cc: 60983@debbugs.gnu.org, theo@thornhill.no >>> Date: Mon, 23 Jan 2023 18:52:33 +0200 >>> From: Eli Zaretskii >>>=20 >>> > From: Theodor Thornhill >>> > Cc: Yuan Fu >>> > Date: Sat, 21 Jan 2023 12:48:58 +0100 >>> >=20 >>> > Eli Zaretskii writes: >>> >=20 >>> > > I started looking into providing user-level documentation for >>> > > tree-sitter based modes, and bumped into some issues: >>> > > >>> > > . How does one use treesit-font-lock-level? >>> > > >>> > > - It is not a customizable user option (unlike >>> > > font-lock-maximum-decoration), so it cannot be set via >>> > > customize-variable. Is there a reason not to make it a >>> > > defcustom? >>> > > - It automatically becomes buffer-local when set, and OTOH = setting >>> > > it in a buffer does not produce fontifications according to = the >>> > > level, and neither does setting it in a mode hook. So the = only >>> > > way to change its value is by using setq-default, which I = don't >>> > > think is the intent? >>> > > - Should we make the variable a defcustom? >>> > > - Should it be possible to customize it separately for each = mode? >>> > > - Should we allow to change the level and then call some = function >>> > > to re-fontify the current buffer according to the new = level? >>> >=20 >>> > I struggled with this too. I ended up setting it with = setq-default, >>> > assuming I was just missing something very simple. I'm in favor = for >>> > either a defcustom or honoring the font-lock-maximum-decoration = values, >>> > specifically these settings: >>> >=20 >>> > ``` >>> > If t, use the maximum decoration available. >>> > If a number, use that level of decoration (or if not available the = maximum). >>> > ``` >> >> Let's just make it a defcustom for now, with the values it has today, >> including the default. >> >> The problems with honoring the value of font-lock-maximum-decoration >> are that (a) its default value is t in most (all?) modes, whereas we >> decided not to use 4 as the default value of treesit-font-lock-level; >> and (b) if changing treesit-font-lock-level's value doesn't require = to >> kill the buffer and revisit the file (as I hope we will make it = work), >> the instructions regarding changing the value of >> font-lock-maximum-decoration will depend on whether the mode does or >> doesn't use tree-sitter, which will make the instructions confusingly >> complex. >> >> Yuan or Theo, would one of you please make the change of making >> treesit-font-lock-level a defcustom, with a proper :set functions to >> avoid the need to revisit the file? My hands are too full ATM, and >> this issue is basically the only one which prevents me from updating >> the Emacs user manual with the tree-sitter info, which in turn is the >> only issue that blocks the move to releasing the 29.0.90 pretest >> tarball. >> >> TIA > > > I can take a stab at it :) > > Theo Thanks! I don=E2=80=99t have a ton of free time right now either. Yuan