From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#60983: 29.0.60; Tree-sitter user-level control Date: Mon, 23 Jan 2023 18:52:33 +0200 Message-ID: <83edrli46m.fsf@gnu.org> References: <83tu0kkuqo.fsf@gnu.org> <87tu0k3y6t.fsf@thornhill.no> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="25587"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 60983@debbugs.gnu.org, theo@thornhill.no To: casouri@gmail.com Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Mon Jan 23 17:53:17 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 1pK04K-0006PS-Tm for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 23 Jan 2023 17:53:17 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pK047-0004Tp-M5; Mon, 23 Jan 2023 11:53:04 -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 1pK046-0004Te-1v for bug-gnu-emacs@gnu.org; Mon, 23 Jan 2023 11:53:02 -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 1pK045-0008V0-Ml for bug-gnu-emacs@gnu.org; Mon, 23 Jan 2023 11:53:01 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1pK045-0006WW-JC for bug-gnu-emacs@gnu.org; Mon, 23 Jan 2023 11:53:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 23 Jan 2023 16:53:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 60983 X-GNU-PR-Package: emacs X-Debbugs-Original-Cc: bug-gnu-emacs@gnu.org, Theodor Thornhill Original-Received: via spool by submit@debbugs.gnu.org id=B.167449274825028 (code B ref -1); Mon, 23 Jan 2023 16:53:01 +0000 Original-Received: (at submit) by debbugs.gnu.org; 23 Jan 2023 16:52:28 +0000 Original-Received: from localhost ([127.0.0.1]:55188 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pK03X-0006Vc-E3 for submit@debbugs.gnu.org; Mon, 23 Jan 2023 11:52:27 -0500 Original-Received: from lists.gnu.org ([209.51.188.17]:41100) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pK03V-0006VT-I2 for submit@debbugs.gnu.org; Mon, 23 Jan 2023 11:52:26 -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 1pK03V-0004KH-BA for bug-gnu-emacs@gnu.org; Mon, 23 Jan 2023 11:52:25 -0500 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pK03V-0008R8-1n; Mon, 23 Jan 2023 11:52:25 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=zyhU3CsQEXvtxSLUc6ciu0s9pmXIUUSsZ77y6GI77og=; b=Co2c1KZsQwsl yJW87anDmIFKH0yyNHyNYOusiP0OEJcO/9geApMcMhAOOHPaDbZDemVqA1EpNY7NJzBlUDrow7owk DqkwixycmOi9GBjysv0zV0NjwipZMYY5o6CiiNbvjADhmWkzDjL6FFUXccaYdmll14G1tBcGwxXoe L8v0WYmI3omxd81QZ+fmDBF2QQJKsHEpoTLiT3fe69j/6lArfKXK/Xqam/wFdbFfibOAF1KOAkGur p0B89LuU6LGK5wmOGMabdDInMeJB61f1FVjTRVPG5MblVdSsWT/1SUqtTb45UutLLgMGSsMNgr93T +it1OcCAgueDZanHp2m14A==; Original-Received: from [87.69.77.57] (helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pK03U-0005EO-I8; Mon, 23 Jan 2023 11:52:24 -0500 In-Reply-To: <87tu0k3y6t.fsf@thornhill.no> (message from Theodor Thornhill on Sat, 21 Jan 2023 12:48:58 +0100) 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:254015 Archived-At: Ping! Yuan, any comments? I'd like to finish this job some time soon, and I need your feedback and/or code changes before I can proceed. > From: Theodor Thornhill > Cc: Yuan Fu > Date: Sat, 21 Jan 2023 12:48:58 +0100 > > Eli Zaretskii writes: > > > 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? > > 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: > > ``` > If t, use the maximum decoration available. > If a number, use that level of decoration (or if not available the maximum). > ``` > > > > > . How does one change the indentation style in c-ts-mode? > > > > - There is a defcustom c-ts-mode-indent-style, but I don't think I > > see any difference in indentation of new code when I change the > > value. What am I missing? > > > > (setq c-ts-mode-indent-style 'bsd) then revert-buffer fixes it for me. > It seems you need to reload the file to enable the new style. Should I > add a command that can be set explicitly as in c-mode? > 'c-ts-mode-set-style'? > > However, going over it I see there are lots of regressions after the new > bracket-counting code added recently, effectively making the indent > styles pretty broken right now... > > For example with bsd style: > > Previously: > > int > main() > { > if (x) > { > > } > else > { > > } > } > > now: > > int > main() > { > if (x) > { > > } > else > { > > } > } > > > > > . What commands are affected by treesit-defun-tactic? > > 'treesit--navigate-thing' uses it, so 'beginning-of-defun', > 'forward-sentence' etc uses it through 'treesit-beginning-of-thing'. > > Theo >