From unknown Sat Aug 16 12:45:36 2025 X-Loop: help-debbugs@gnu.org Subject: bug#60983: 29.0.60; Tree-sitter user-level control Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 21 Jan 2023 11:12:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 60983 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: 60983@debbugs.gnu.org Cc: Yuan Fu , Theodor Thornhill X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.16742994883212 (code B ref -1); Sat, 21 Jan 2023 11:12:01 +0000 Received: (at submit) by debbugs.gnu.org; 21 Jan 2023 11:11:28 +0000 Received: from localhost ([127.0.0.1]:48158 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pJBmS-0000pk-Bb for submit@debbugs.gnu.org; Sat, 21 Jan 2023 06:11:28 -0500 Received: from lists.gnu.org ([209.51.188.17]:37788) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pJBmQ-0000pc-QP for submit@debbugs.gnu.org; Sat, 21 Jan 2023 06:11:27 -0500 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 1pJBmQ-0008Jh-Fn for bug-gnu-emacs@gnu.org; Sat, 21 Jan 2023 06:11:26 -0500 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 1pJBmP-0002qy-HS; Sat, 21 Jan 2023 06:11:25 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=Subject:To:From:Date:mime-version:in-reply-to: references; bh=eFsKUSScwtBHutQvA/IBwZrf7QUWiLCmaqni95+qNHc=; b=sO/DOhXwcFDBlO OSQInMtV7TOwD1ghJeeBqBX3FQ5PqVGc5TkC/uvb9bSmpyruR/QD6VknozEDE4pudnNAAcXGcPuGq miPlyuTWch9nZdv5LtvuxTRXcNSlyjhg1f/2ylMqp9tUB1ha5FY8yOVAdAYOTJw2ayOwbkJUgZRG4 iFGlNEZKcNY01FFdmxIpd5MH1LUBAWVuyUwTJtNgjC1f05LwEg43mADGdYVm/lLuPryQfwlYMvup9 MqbcQgu14fWjOKJAPBk2SxYaoLztpA73uZYO9mmbvipsp6o0LWzTXTjdUWtTPqzFxf5Q0RdZnzT4x mP37pYXUleoo0MXzK6mg==; 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 1pJBmO-0003jC-Ud; Sat, 21 Jan 2023 06:11:25 -0500 Date: Sat, 21 Jan 2023 13:11:27 +0200 Message-Id: <83tu0kkuqo.fsf@gnu.org> From: Eli Zaretskii X-Spam-Score: -2.3 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) 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? . 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? . What commands are affected by treesit-defun-tactic? In GNU Emacs 29.0.60 (build 238, i686-pc-mingw32) of 2023-01-20 built on HOME-C4E4A596F7 Repository revision: 472f142598566fbaeedcacaf9a9c757a1281c0c5 Repository branch: emacs-29 Windowing system distributor 'Microsoft Corp.', version 5.1.2600 System Description: Microsoft Windows XP Service Pack 3 (v5.1.0.2600) Configured using: 'configure -C --prefix=/d/usr --with-wide-int --enable-checking=yes,glyphs 'CFLAGS=-O0 -gdwarf-4 -g3'' Configured features: ACL GIF GMP GNUTLS HARFBUZZ JPEG JSON LCMS2 LIBXML2 MODULES NOTIFY W32NOTIFY PDUMPER PNG RSVG SOUND SQLITE3 THREADS TIFF TOOLKIT_SCROLL_BARS TREE_SITTER WEBP XPM ZLIB Important settings: value of $LANG: ENU locale-coding-system: cp1255 Major mode: C Minor modes in effect: tooltip-mode: t global-eldoc-mode: t show-paren-mode: t electric-indent-mode: t mouse-wheel-mode: t tool-bar-mode: t menu-bar-mode: t file-name-shadow-mode: t global-font-lock-mode: t font-lock-mode: t blink-cursor-mode: t line-number-mode: t indent-tabs-mode: t transient-mark-mode: t auto-composition-mode: t auto-encryption-mode: t auto-compression-mode: t Load-path shadows: None found. Features: (shadow sort mail-extr emacsbug message mailcap yank-media puny dired dired-loaddefs rfc822 mml mml-sec password-cache epa derived epg rfc6068 epg-config gnus-util time-date subr-x mm-decode mm-bodies mm-encode mail-parse rfc2231 mailabbrev gmm-utils mailheader sendmail rfc2047 rfc2045 ietf-drums mm-util mail-prsvr mail-utils shortdoc text-property-search misearch multi-isearch cl-extra cl-print thingatpt help-fns radix-tree pp wid-edit descr-text help-mode c-ts-mode treesit cl-seq vc-git diff-mode easy-mmode vc vc-dispatcher bug-reference byte-opt gv bytecomp byte-compile cc-mode cc-fonts cc-guess cc-menus cc-cmds cc-styles cc-align cc-engine cc-vars cc-defs cl-loaddefs cl-lib rmc iso-transl tooltip cconv eldoc paren electric uniquify ediff-hook vc-hooks lisp-float-type elisp-mode mwheel dos-w32 ls-lisp disp-table term/w32-win w32-win w32-vars term/common-win tool-bar dnd fontset image regexp-opt fringe tabulated-list replace newcomment text-mode lisp-mode prog-mode register page tab-bar menu-bar rfn-eshadow isearch easymenu timer select scroll-bar mouse jit-lock font-lock syntax font-core term/tty-colors frame minibuffer nadvice seq simple cl-generic indonesian philippine cham georgian utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao korean japanese eucjp-ms cp51932 hebrew greek romanian slovak czech european ethiopic indian cyrillic chinese composite emoji-zwj charscript charprop case-table epa-hook jka-cmpr-hook help abbrev obarray oclosure cl-preloaded button loaddefs theme-loaddefs faces cus-face macroexp files window text-properties overlay sha1 md5 base64 format env code-pages mule custom widget keymap hashtable-print-readable backquote threads w32notify w32 lcms2 multi-tty make-network-process emacs) Memory information: ((conses 16 107446 10610) (symbols 48 10355 0) (strings 16 33788 3445) (string-bytes 1 1014069) (vectors 16 17439) (vector-slots 8 223440 13934) (floats 8 91 195) (intervals 40 3548 140) (buffers 888 14)) From unknown Sat Aug 16 12:45:36 2025 X-Loop: help-debbugs@gnu.org Subject: bug#60983: 29.0.60; Tree-sitter user-level control Resent-From: Theodor Thornhill Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 21 Jan 2023 11:50:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 60983 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: eliz@gnu.org, 60983@debbugs.gnu.org Cc: Yuan Fu X-Debbugs-Original-To: Eli Zaretskii , bug-gnu-emacs@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.16743017557441 (code B ref -1); Sat, 21 Jan 2023 11:50:02 +0000 Received: (at submit) by debbugs.gnu.org; 21 Jan 2023 11:49:15 +0000 Received: from localhost ([127.0.0.1]:48195 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pJCN0-0001vx-U2 for submit@debbugs.gnu.org; Sat, 21 Jan 2023 06:49:15 -0500 Received: from lists.gnu.org ([209.51.188.17]:37432) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pJCMy-0001vo-A5 for submit@debbugs.gnu.org; Sat, 21 Jan 2023 06:49:13 -0500 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 1pJCMy-0006HL-0O for bug-gnu-emacs@gnu.org; Sat, 21 Jan 2023 06:49:12 -0500 Received: from out0.migadu.com ([2001:41d0:2:267::]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pJCMu-0000oI-JN; Sat, 21 Jan 2023 06:49:11 -0500 X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=thornhill.no; s=key1; t=1674301742; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=wpLeYoVwPIihEM8XKDMIAIdgAjdydqlHircI3K5JCRI=; b=bv7iFy99+yCHcq2r6Qi7a8j1+IFV5HwIDX1/3XLmuJnxO2esDFKkz6z01IuHivEZOVJ4Rb ydHAZJI9xZDCWd9rlBINuAomMXDXwBTvNh3SxTnY2hdIq5myr/eYj5CjJWzrFu7OMmGpst IJK8GXyI8I8qPcMYLPrSPfQI36P+uDZ3jj+VIFS1VOaQFIJnrkHBbVWuIO0Q/43MlD6Uzo d0/26Hj5/ygq9pzAdKeMIfMyTT4OMiargYjgPCfKXGvCw9pDUqEySbBfNiGiZHUiroD4Iq CFmZjdZSVIU7BdVByE6w8WwNtdgFO5io5GnsEOlCehxVZ8sp48WOza+O9mP2qg== From: Theodor Thornhill In-Reply-To: <83tu0kkuqo.fsf@gnu.org> References: <83tu0kkuqo.fsf@gnu.org> Date: Sat, 21 Jan 2023 12:48:58 +0100 Message-ID: <87tu0k3y6t.fsf@thornhill.no> MIME-Version: 1.0 Content-Type: text/plain X-Migadu-Flow: FLOW_OUT Received-SPF: pass client-ip=2001:41d0:2:267::; envelope-from=theo@thornhill.no; helo=out0.migadu.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 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, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: -1.4 (-) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.4 (--) 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 From unknown Sat Aug 16 12:45:36 2025 X-Loop: help-debbugs@gnu.org Subject: bug#60983: 29.0.60; Tree-sitter user-level control Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 21 Jan 2023 12:37:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 60983 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Theodor Thornhill Cc: 60983@debbugs.gnu.org, casouri@gmail.com X-Debbugs-Original-Cc: bug-gnu-emacs@gnu.org, casouri@gmail.com Received: via spool by submit@debbugs.gnu.org id=B.167430456320975 (code B ref -1); Sat, 21 Jan 2023 12:37:02 +0000 Received: (at submit) by debbugs.gnu.org; 21 Jan 2023 12:36:03 +0000 Received: from localhost ([127.0.0.1]:48240 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pJD6I-0005SE-MH for submit@debbugs.gnu.org; Sat, 21 Jan 2023 07:36:02 -0500 Received: from lists.gnu.org ([209.51.188.17]:43958) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pJD6G-0005Rl-6J for submit@debbugs.gnu.org; Sat, 21 Jan 2023 07:36:00 -0500 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 1pJD6F-0001Ex-76 for bug-gnu-emacs@gnu.org; Sat, 21 Jan 2023 07:35:59 -0500 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 1pJD6E-0006yN-AT; Sat, 21 Jan 2023 07:35:58 -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=gLJ+pTo0234H04FQUggl3i4WKozKEn3VT5e252AM3ng=; b=ixP7qSvv/1Ya be2axK7SKSbQBOaByYFlvc1liPKlqDIylAo/5vJwa3LwUuQggDE36PCUT8CctwyWUNfSO3egClB4U EW77/HPNjmIkc2NYghVosjrM9z1AAYXURSoZM7GsnAoR7Jz49GsITPwFECkmZM2DwcUluB6n2RF+7 R/2aJNBhNqNz81j13E4x1vNMLYI3Gp6BxEu7rvC1knlF+DtklrUhXI4N3ioyLlM59gd40X1poBWFE ktBppUF1yHNvkowid5BvOJgTAvg/b+LvgHt7WnqQUF6IvM4pzxnYZMS599brIokLkiqOn8DLVJvBd 2YwAfNkfFSQPacpQ5nIDgg==; 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 1pJD6D-00014D-8P; Sat, 21 Jan 2023 07:35:58 -0500 Date: Sat, 21 Jan 2023 14:36:00 +0200 Message-Id: <83mt6ckqts.fsf@gnu.org> From: Eli Zaretskii In-Reply-To: <87tu0k3y6t.fsf@thornhill.no> (message from Theodor Thornhill on Sat, 21 Jan 2023 12:48:58 +0100) References: <83tu0kkuqo.fsf@gnu.org> <87tu0k3y6t.fsf@thornhill.no> X-Spam-Score: -2.3 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > From: Theodor Thornhill > Cc: Yuan Fu > Date: Sat, 21 Jan 2023 12:48:58 +0100 > > Eli Zaretskii writes: > > > . 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'? I think we need both a command and a :set function for the defcustom. > 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... That's a separate issue, and I'm sure it will be fixed. And adding tests to the test suite will prevent us from breaking it too easily in the future. > > . 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'. What commands except those that call treesit--navigate-thing call beginning-of-defun and treesit-beginning-of-thing? From unknown Sat Aug 16 12:45:36 2025 X-Loop: help-debbugs@gnu.org Subject: bug#60983: 29.0.60; Tree-sitter user-level control Resent-From: Theodor Thornhill Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 21 Jan 2023 12:41:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 60983 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Eli Zaretskii Cc: 60983@debbugs.gnu.org, casouri@gmail.com X-Debbugs-Original-Cc: bug-gnu-emacs@gnu.org, casouri@gmail.com Received: via spool by submit@debbugs.gnu.org id=B.167430485821472 (code B ref -1); Sat, 21 Jan 2023 12:41:02 +0000 Received: (at submit) by debbugs.gnu.org; 21 Jan 2023 12:40:58 +0000 Received: from localhost ([127.0.0.1]:48267 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pJDB4-0005aF-0C for submit@debbugs.gnu.org; Sat, 21 Jan 2023 07:40:58 -0500 Received: from lists.gnu.org ([209.51.188.17]:44148) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pJDB2-0005a7-08 for submit@debbugs.gnu.org; Sat, 21 Jan 2023 07:40:56 -0500 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 1pJDB1-0002ND-Ah for bug-gnu-emacs@gnu.org; Sat, 21 Jan 2023 07:40:55 -0500 Received: from out-127.mta0.migadu.com ([2001:41d0:1004:224b::7f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pJDAz-0002rj-Ab for bug-gnu-emacs@gnu.org; Sat, 21 Jan 2023 07:40:55 -0500 X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=thornhill.no; s=key1; t=1674304850; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=XN25MGuD6aWPxEtW9EGQlZdeEsxKB8AeJ50QW5lUqUE=; b=nJn/luWcHVUbyb84KyZwknSRIh6AZRFHsO76i4tc2D7lnpErryaE/0ypvOC2nD3BjKe5iW Qy6XyapZoPT9yqEUEDh5mGc4+zkSC32rmFK/xj/VZgyeDr9BFaB+i43khfDdDAvmBX9qQw 8wLlxcXJTV4zZzEIj5VhgyliUtOvRnkoAlge57SGS+AXLuYE8lZPp1EewtoJEBn6taAwzt AC/D0IseJxeaVeWNoZ3z/pe66zdRjrGT4/hCbgNDsZ4xZHWcxawgRm711CMlceZe1HI8i7 lg4ZVesc6cgj3kYEs1UWGI9gugLt0CwyqrC8/JlGiDqP/U3Ee3d6rNFupYcWhA== From: Theodor Thornhill In-Reply-To: <83mt6ckqts.fsf@gnu.org> References: <83tu0kkuqo.fsf@gnu.org> <87tu0k3y6t.fsf@thornhill.no> <83mt6ckqts.fsf@gnu.org> Date: Sat, 21 Jan 2023 13:40:49 +0100 Message-ID: <87zgacgiwe.fsf@thornhill.no> MIME-Version: 1.0 Content-Type: text/plain X-Migadu-Flow: FLOW_OUT Received-SPF: pass client-ip=2001:41d0:1004:224b::7f; envelope-from=theo@thornhill.no; helo=out-127.mta0.migadu.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, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-Spam-Score: -1.4 (-) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.4 (--) Eli Zaretskii writes: >> From: Theodor Thornhill >> Cc: Yuan Fu >> Date: Sat, 21 Jan 2023 12:48:58 +0100 >> >> Eli Zaretskii writes: >> >> > . 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'? > > I think we need both a command and a :set function for the defcustom. > Ok, I'll make a bugreport for this. >> 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... > > That's a separate issue, and I'm sure it will be fixed. And adding > tests to the test suite will prevent us from breaking it too easily in > the future. > And this. >> > . 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'. > > What commands except those that call treesit--navigate-thing call > beginning-of-defun and treesit-beginning-of-thing? I'll defer to Yuan for this :) Theo From unknown Sat Aug 16 12:45:36 2025 X-Loop: help-debbugs@gnu.org Subject: bug#60983: 29.0.60; Tree-sitter user-level control 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-GNU-PR-Keywords: To: casouri@gmail.com Cc: 60983@debbugs.gnu.org, theo@thornhill.no X-Debbugs-Original-Cc: bug-gnu-emacs@gnu.org, Theodor Thornhill Received: via spool by submit@debbugs.gnu.org id=B.167449274825028 (code B ref -1); Mon, 23 Jan 2023 16:53:01 +0000 Received: (at submit) by debbugs.gnu.org; 23 Jan 2023 16:52:28 +0000 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 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 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 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==; 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 Date: Mon, 23 Jan 2023 18:52:33 +0200 Message-Id: <83edrli46m.fsf@gnu.org> From: Eli Zaretskii In-Reply-To: <87tu0k3y6t.fsf@thornhill.no> (message from Theodor Thornhill on Sat, 21 Jan 2023 12:48:58 +0100) References: <83tu0kkuqo.fsf@gnu.org> <87tu0k3y6t.fsf@thornhill.no> X-Spam-Score: -2.3 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) 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 > From unknown Sat Aug 16 12:45:36 2025 X-Loop: help-debbugs@gnu.org Subject: bug#60983: 29.0.60; Tree-sitter user-level control Resent-From: Yuan Fu Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 23 Jan 2023 19:38:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 60983 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Theodor Thornhill Cc: eliz@gnu.org, 60983@debbugs.gnu.org X-Debbugs-Original-Cc: Eli Zaretskii , Bug Report Emacs Received: via spool by submit@debbugs.gnu.org id=B.16745026639395 (code B ref -1); Mon, 23 Jan 2023 19:38:02 +0000 Received: (at submit) by debbugs.gnu.org; 23 Jan 2023 19:37:43 +0000 Received: from localhost ([127.0.0.1]:55370 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pK2dT-0002RS-EY for submit@debbugs.gnu.org; Mon, 23 Jan 2023 14:37:43 -0500 Received: from lists.gnu.org ([209.51.188.17]:60290) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pK2dR-0002RK-0P for submit@debbugs.gnu.org; Mon, 23 Jan 2023 14:37:41 -0500 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 1pK2dQ-0004P5-JU for bug-gnu-emacs@gnu.org; Mon, 23 Jan 2023 14:37:40 -0500 Received: from mail-pf1-x42e.google.com ([2607:f8b0:4864:20::42e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pK2dP-0001ix-0v; Mon, 23 Jan 2023 14:37:40 -0500 Received: by mail-pf1-x42e.google.com with SMTP id 207so9649686pfv.5; Mon, 23 Jan 2023 11:37:38 -0800 (PST) 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=CiRumTyQ81W+n5LPM8prS9Nmf/pm8qH6GjJp0Awy8So=; b=qV7bBFQPgmPOA4WrBtwDsidVBMtb9C/KJnEoo6JrSdE3ENSdbXSGP/DgTQw1MLVr/H xRkPWegNGOEw4RYQehRA1i5n5UXZGZfdEZg3bfZXTg1HpQ1aFgQaqNYStEJJgkMxKkyl HzKnT3MZWEK+u97RhPa3MFV/U4fFT38/vKQ/htS92FGu3c1QZubdvNCETXIxOVBmCj42 B4gAQklkZGaRBNqsU4pmlmv2ke7CvaWl27JQX9KeBkpZflEQohYauz8V82q14o9Y+COy UI8xOcMEQcF/F+k9nWzmL3zvKoirucVH6MhJtq7+cMY0Q83fIqZgQKcbF/fzQvvKXCya 0yaQ== 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=CiRumTyQ81W+n5LPM8prS9Nmf/pm8qH6GjJp0Awy8So=; b=uZbPIbIR/1MF80F1jNHgV/VDHmBRNGE36zzYvTiJW+GZgaUEPfgPuRilo/rZcLUC1T 67U0N89cwSNt6/q1NSfdPTT712zkLeW0CBaCLK2RWemSTeRY/4XHzseWkS35JUYAX89H o9MjBJjMmrx9arGM5kq37/R9W3xLAX5Pa6gU2dz8CEX2jGw01i96ekuXJujblpGF6gLm gLf+iglgFFROJpbv/JvXHIan8t8sP7HOljfWJGJ80pYdqboMlap2eE8s0fp4BOHNzJEW DFC7WzOSKK0Z+2slT6rYymSBc+yYmIYVjHFj+4QSJ16xRDKAmwOhR66uTsJ0zwZ1jBTG PXxA== X-Gm-Message-State: AFqh2kqs1waeDwxlWLW6yyEfZE3rXA9UHYPwjgHoqa7lA6Um9WQZmtJB 40vk0eyLuPTnTpfhvnNtov0= X-Google-Smtp-Source: AMrXdXtU1MaxBLcypi1bjYEknT3xF29/T9fd2u5HKjc7nHwiGXWRfYyuttDaX8okmdsDn9pahfmV9Q== X-Received: by 2002:a62:6144:0:b0:583:9b05:d1f0 with SMTP id v65-20020a626144000000b005839b05d1f0mr25014614pfb.33.1674502656057; Mon, 23 Jan 2023 11:37:36 -0800 (PST) Received: from smtpclient.apple (cpe-172-117-161-177.socal.res.rr.com. [172.117.161.177]) by smtp.gmail.com with ESMTPSA id y12-20020a62640c000000b005819313269csm31476706pfb.124.2023.01.23.11.37.35 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 23 Jan 2023 11:37:35 -0800 (PST) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3731.300.101.1.3\)) From: Yuan Fu In-Reply-To: <87zgacgiwe.fsf@thornhill.no> Date: Mon, 23 Jan 2023 11:37:24 -0800 Content-Transfer-Encoding: quoted-printable Message-Id: References: <83tu0kkuqo.fsf@gnu.org> <87tu0k3y6t.fsf@thornhill.no> <83mt6ckqts.fsf@gnu.org> <87zgacgiwe.fsf@thornhill.no> X-Mailer: Apple Mail (2.3731.300.101.1.3) Received-SPF: pass client-ip=2607:f8b0:4864:20::42e; envelope-from=casouri@gmail.com; helo=mail-pf1-x42e.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-Spam-Score: -1.3 (-) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.3 (--) Sorry for the delay, overall I agree with your changes. >=20 > . How does one use treesit-font-lock-level? >=20 > - 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? Yeah it should be a defcustom.=20 > - 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? You can set this variable and call treesit-font-lock-recompute-features = with no argument, which enables/disables features according to the = current level. > Ok, I'll make a bugreport for this. >=20 >>> 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... Sorry about that :-( >=20 >=20 >>>> . What commands are affected by treesit-defun-tactic? >>>=20 >>> 'treesit--navigate-thing' uses it, so 'beginning-of-defun', >>> 'forward-sentence' etc uses it through 'treesit-beginning-of-thing'. >>=20 >> What commands except those that call treesit--navigate-thing call >> beginning-of-defun and treesit-beginning-of-thing? >=20 > I'll defer to Yuan for this :) treesit-beginning/end-of-defun are called by beginning/end-of-defun, so = other functions like mark-defund are also affected by = treesit-defun-tactic. Treesit-beginning-of-thing is on master, not on = emacs-29. Yuan= From unknown Sat Aug 16 12:45:36 2025 X-Loop: help-debbugs@gnu.org Subject: bug#60983: 29.0.60; Tree-sitter user-level control Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 23 Jan 2023 20:00:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 60983 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Yuan Fu Cc: 60983@debbugs.gnu.org, theo@thornhill.no X-Debbugs-Original-Cc: bug-gnu-emacs@gnu.org, theo@thornhill.no Received: via spool by submit@debbugs.gnu.org id=B.167450394711653 (code B ref -1); Mon, 23 Jan 2023 20:00:02 +0000 Received: (at submit) by debbugs.gnu.org; 23 Jan 2023 19:59:07 +0000 Received: from localhost ([127.0.0.1]:55376 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pK2yB-00031t-Hp for submit@debbugs.gnu.org; Mon, 23 Jan 2023 14:59:07 -0500 Received: from lists.gnu.org ([209.51.188.17]:42534) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pK2yA-00031m-26 for submit@debbugs.gnu.org; Mon, 23 Jan 2023 14:59:06 -0500 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 1pK2y9-000219-Rb for bug-gnu-emacs@gnu.org; Mon, 23 Jan 2023 14:59:05 -0500 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 1pK2y9-00051r-Fw; Mon, 23 Jan 2023 14:59:05 -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=6cPGvVQ+OZR9K4nEUEMQnorWNZYA2SAW+ZHd2sHerHA=; b=T9jfABTub+BP ShWQ7c2hnEXWwrsBQH4hkWc3V5wIKrg7uLa0uzZLLXTAKqe0p48O2FLju3qyoMBb8nYVbUakGetVb S4bQeYTJd9SnmqffHYPqiczo0PKM9YMchbKKvwM2PTljsG+N8dcH4imM26927YECXm+l/au1rpuIv pqaryZKOG4outJbkgXk9pi8fJ9jQJ/ufo/wPXPUyRHHYvLI74vm5HAgV3nnjmNmcTYGdsAb78lie4 cycd8/0oAxZmaXWiuKcdNNfC506CfM7gi69HGz1v+Aw/kONfRPMjJxr3LBK1MuSDlS4F5XhBkDFX2 4KHTF1eACwJuSStm4motww==; 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 1pK2y8-00019P-VE; Mon, 23 Jan 2023 14:59:05 -0500 Date: Mon, 23 Jan 2023 21:59:14 +0200 Message-Id: <834jshhvjh.fsf@gnu.org> From: Eli Zaretskii In-Reply-To: (message from Yuan Fu on Mon, 23 Jan 2023 11:37:24 -0800) References: <83tu0kkuqo.fsf@gnu.org> <87tu0k3y6t.fsf@thornhill.no> <83mt6ckqts.fsf@gnu.org> <87zgacgiwe.fsf@thornhill.no> X-Spam-Score: -2.3 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > From: Yuan Fu > Date: Mon, 23 Jan 2023 11:37:24 -0800 > Cc: Eli Zaretskii , > Bug Report Emacs > > Sorry for the delay, overall I agree with your changes. Thanks. What about the questions I asked regarding indentation features, and specifically about c-ts-mode-indent-style? From unknown Sat Aug 16 12:45:36 2025 X-Loop: help-debbugs@gnu.org Subject: bug#60983: 29.0.60; Tree-sitter user-level control Resent-From: Theodor Thornhill Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 23 Jan 2023 21:10:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 60983 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Eli Zaretskii , Yuan Fu Cc: 60983@debbugs.gnu.org X-Debbugs-Original-Cc: bug-gnu-emacs@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.167450816927992 (code B ref -1); Mon, 23 Jan 2023 21:10:02 +0000 Received: (at submit) by debbugs.gnu.org; 23 Jan 2023 21:09:29 +0000 Received: from localhost ([127.0.0.1]:55438 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pK44H-0007HQ-9v for submit@debbugs.gnu.org; Mon, 23 Jan 2023 16:09:29 -0500 Received: from lists.gnu.org ([209.51.188.17]:37314) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pK44G-0007HI-1q for submit@debbugs.gnu.org; Mon, 23 Jan 2023 16:09:28 -0500 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 1pK44E-0004lz-Fk for bug-gnu-emacs@gnu.org; Mon, 23 Jan 2023 16:09:26 -0500 Received: from out0.migadu.com ([94.23.1.103]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pK44B-0007EH-2G; Mon, 23 Jan 2023 16:09:25 -0500 Date: Mon, 23 Jan 2023 22:08:27 +0100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=thornhill.no; s=key1; t=1674508158; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=qBYBi2LYzVDVvVWvx6c+dOVYuQovKNw4C5RqzLmhTdk=; b=GV6gXhOz6/mKQawoBzx7rH0HBUZ8XhTMHtQffpwgdI+kOhtHouI5DI5INi+bOnJWNhn5JO NZD69Z3fWoMRNakJMPL/uXv4popHZTZXTRP+crH4C/ZCnDX9pgtsLehgu0kHMg8WuxzuLp MW+21PYbGk18Bac+FEL+KVmGnfdnn+NACXV3zDv5Hg30Bx2JCbfG2igJhGmTjbc6c02RuI /ymxgU3t+ijne3xaxPI0hFDpd/AeG/Bm1KeImBz1Ty+e9hWXB1AhrJq/Yw4oPrTB6M+ucj nkC7iSO3159cNTTMAmSRT0IGymt/oiebncjjqi5Vmuqe23qKVE//uIrDHvHB7Q== X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Theodor Thornhill In-Reply-To: <834jshhvjh.fsf@gnu.org> References: <83tu0kkuqo.fsf@gnu.org> <87tu0k3y6t.fsf@thornhill.no> <83mt6ckqts.fsf@gnu.org> <87zgacgiwe.fsf@thornhill.no> <834jshhvjh.fsf@gnu.org> Message-ID: <806A8560-A675-423F-9CFC-67D50D14E304@thornhill.no> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Migadu-Flow: FLOW_OUT Received-SPF: pass client-ip=94.23.1.103; envelope-from=theo@thornhill.no; helo=out0.migadu.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 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, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: -1.4 (-) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.4 (--) On 23 January 2023 20:59:14 CET, Eli Zaretskii wrote: >> From: Yuan Fu >> Date: Mon, 23 Jan 2023 11:37:24 -0800 >> Cc: Eli Zaretskii , >> Bug Report Emacs >>=20 >> Sorry for the delay, overall I agree with your changes=2E > >Thanks=2E What about the questions I asked regarding indentation >features, and specifically about c-ts-mode-indent-style? I am working on that, but I hit some issues where I cannot make treesit re= cognize the new settings before the whole treesit-major-mode-setup reruns= =2E Just setting the symbol doesn't work, and reenabling the mode inside of= the :set function isn't the best idea maybe? I'd love some pointers to how other modes do similar stuff, but I didn't r= eally find anything=2E Theo From unknown Sat Aug 16 12:45:36 2025 X-Loop: help-debbugs@gnu.org Subject: bug#60983: 29.0.60; Tree-sitter user-level control Resent-From: Yuan Fu Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 23 Jan 2023 23:56:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 60983 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Theodor Thornhill Cc: eliz@gnu.org, 60983@debbugs.gnu.org X-Debbugs-Original-Cc: Eli Zaretskii , Bug Report Emacs Received: via spool by submit@debbugs.gnu.org id=B.167451815522294 (code B ref -1); Mon, 23 Jan 2023 23:56:02 +0000 Received: (at submit) by debbugs.gnu.org; 23 Jan 2023 23:55:55 +0000 Received: from localhost ([127.0.0.1]:55594 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pK6fK-0005nV-JM for submit@debbugs.gnu.org; Mon, 23 Jan 2023 18:55:54 -0500 Received: from lists.gnu.org ([209.51.188.17]:53428) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pK6fI-0005nM-6c for submit@debbugs.gnu.org; Mon, 23 Jan 2023 18:55:52 -0500 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 1pK6fG-0005hW-Ls for bug-gnu-emacs@gnu.org; Mon, 23 Jan 2023 18:55:51 -0500 Received: from mail-pg1-x529.google.com ([2607:f8b0:4864:20::529]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pK6fB-0000vY-1S; Mon, 23 Jan 2023 18:55:50 -0500 Received: by mail-pg1-x529.google.com with SMTP id e10so10225909pgc.9; Mon, 23 Jan 2023 15:55:44 -0800 (PST) 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=LxXmLlyOukANVuQWcdtQZ3CxVW+L3pthtwpVOpKS8bg=; b=BtI8GOOlr/ctDr7VS+KLk0R+0FYUOrKBGfSZKMplUxWHWmvAnCUzTtX+pS76KJA9fx lDGbKwOSuBZInlsckFoo16Iw/GhH5c6hSaQHgbBt0UKIcbM7NIjHxZN6BvWixL8TGte8 o2vJPn6/gI7EA5/kgd58O52VpH72BBBWUwnI1TCx6D9DNQ6kgOIk4daw7PnD5ohLixld SHExfjEGvh480NFwQFAvu5gFOFPrTSH7TOqQEyNxrMNRGngK6uwby3a++V2qcvZkjNGY 4vdcWqw9PYbnz3xv/tY16KFURbR+AYQVcJ9Z9l2vIOxwQ7TNuDRoY3lirfIufSDdjCMU feFA== 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=LxXmLlyOukANVuQWcdtQZ3CxVW+L3pthtwpVOpKS8bg=; b=TW1s5dL4iLeYnUwgQxYHxA+nKjg1EkHhEpSBqZrpnoOjORhUTn5rgqE+hfZrQJ3mGU eFYsW90eHwRHPepdoxFPDKq44DjXpohRde6jrqbDwORCyRu9M00+xcj3vcUepjSpuhTB HNslgaV81KEdmn2QNZZRmnM6FtvNxuN/xOIbXLgMvsCxuEmoBCfCCsRpF4y9XHfA7SoC eO90uQzGFQffP1wLVyXdMJ5h93ZkL0FCU/6XQY7IaB5PP1t6jUgjrO8ov1EG6w4jelsX erjEOLm3JDq0wPNyjygAomMgvGTqszaoUubokxyXb17ZBa7SsKdPDBq7xtBVFvpcXSxJ Ll/A== X-Gm-Message-State: AFqh2kqSD28mb/dK3bVxuGHVhAEPE1CZ6MG3sm1VoeDWiy7SLyGJgGR/ JTa58mT84xPvhVJ30LVvT8mZt1mamaE= X-Google-Smtp-Source: AMrXdXvRMRXYYXTfnrHX73JhnLXiOPUXHBYbZWC/thBaR0NIOxj9f86CCkamj7F8PNkxAbWMzdjBcA== X-Received: by 2002:a62:154f:0:b0:581:3557:f75b with SMTP id 76-20020a62154f000000b005813557f75bmr51537686pfv.5.1674518142709; Mon, 23 Jan 2023 15:55:42 -0800 (PST) Received: from smtpclient.apple (cpe-172-117-161-177.socal.res.rr.com. [172.117.161.177]) by smtp.gmail.com with ESMTPSA id q13-20020a056a0002ad00b00587304cbd3fsm147628pfs.181.2023.01.23.15.55.42 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 23 Jan 2023 15:55:42 -0800 (PST) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3731.300.101.1.3\)) From: Yuan Fu In-Reply-To: <806A8560-A675-423F-9CFC-67D50D14E304@thornhill.no> Date: Mon, 23 Jan 2023 15:55:30 -0800 Content-Transfer-Encoding: quoted-printable Message-Id: References: <83tu0kkuqo.fsf@gnu.org> <87tu0k3y6t.fsf@thornhill.no> <83mt6ckqts.fsf@gnu.org> <87zgacgiwe.fsf@thornhill.no> <834jshhvjh.fsf@gnu.org> <806A8560-A675-423F-9CFC-67D50D14E304@thornhill.no> X-Mailer: Apple Mail (2.3731.300.101.1.3) Received-SPF: pass client-ip=2607:f8b0:4864:20::529; envelope-from=casouri@gmail.com; helo=mail-pg1-x529.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-Spam-Score: -1.3 (-) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.3 (--) > On Jan 23, 2023, at 1:08 PM, Theodor Thornhill = wrote: >=20 >=20 >=20 > On 23 January 2023 20:59:14 CET, Eli Zaretskii wrote: >>> From: Yuan Fu >>> Date: Mon, 23 Jan 2023 11:37:24 -0800 >>> Cc: Eli Zaretskii , >>> Bug Report Emacs >>>=20 >>> Sorry for the delay, overall I agree with your changes. >>=20 >> Thanks. What about the questions I asked regarding indentation >> features, and specifically about c-ts-mode-indent-style? >=20 > I am working on that, but I hit some issues where I cannot make = treesit recognize the new settings before the whole = treesit-major-mode-setup reruns. Just setting the symbol doesn't work, = and reenabling the mode inside of the :set function isn't the best idea = maybe? >=20 > I'd love some pointers to how other modes do similar stuff, but I = didn't really find anything. One common approach is to iterate over all live buffer and reset the = variable (in this case treesit-simple-indent-rules) on applicate buffers = (in this case c/c++-ts-mode buffers). It would be nice to also have a command c-ts-mode-set-style (like = c-set-style) that takes a style symbol and sets = treesit-simple-indent-rules accordingly. And in major-mode setup, ie, = c-ts-mode=E2=80=99s body, you call it with c-ts-mode-indent-style. Yuan From unknown Sat Aug 16 12:45:36 2025 X-Loop: help-debbugs@gnu.org Subject: bug#60983: 29.0.60; Tree-sitter user-level control Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 24 Jan 2023 03:27:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 60983 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Theodor Thornhill , Stefan Monnier Cc: casouri@gmail.com, 60983@debbugs.gnu.org X-Debbugs-Original-Cc: casouri@gmail.com, bug-gnu-emacs@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.167453081511488 (code B ref -1); Tue, 24 Jan 2023 03:27:01 +0000 Received: (at submit) by debbugs.gnu.org; 24 Jan 2023 03:26:55 +0000 Received: from localhost ([127.0.0.1]:55678 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pK9xX-0002zE-G3 for submit@debbugs.gnu.org; Mon, 23 Jan 2023 22:26:55 -0500 Received: from lists.gnu.org ([209.51.188.17]:57180) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pK9xV-0002z6-01 for submit@debbugs.gnu.org; Mon, 23 Jan 2023 22:26:54 -0500 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 1pK9xU-00079I-Nc for bug-gnu-emacs@gnu.org; Mon, 23 Jan 2023 22:26:52 -0500 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 1pK9xS-0000P5-D2; Mon, 23 Jan 2023 22:26:50 -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=qlvjddNCXUboMDd63oL8uExMPeDOzJ14tNRSehYSmfw=; b=sCA5L902f4lh cWLK1/iZYbHwVL6EZms4bzDTgcjS4wfRxqxN88kXmH+qlesrhkGTJIB3eiw4BaJcHNNbEut4F5X13 JaQRxv18g1xQLDHr/HMsEuLGlWAzklfHoSWq0JIq8KM2aX0xQ/50UqDD1ymF1XsZiQecJPKSWOXGP C4lFr4TdNXYobpm6yt+i5W+TQFNFiwCSU17dUUnWY8oFKgxGupSLQ13XKxKNOYA6rBXDQDAB8dw8b UtC0ZvYcnpf1dZWk7pObmSZxrBBgE8JzkIG+88oJ4w7U2+Nl3mk2h6dzlbJ7eGbnstT9dGl4d3/jE dyRUYVzjNWPKJ+d6UL8zXw==; 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 1pK9xR-0003SS-Qd; Mon, 23 Jan 2023 22:26:50 -0500 Date: Tue, 24 Jan 2023 05:26:59 +0200 Message-Id: <833580ipdo.fsf@gnu.org> From: Eli Zaretskii In-Reply-To: <806A8560-A675-423F-9CFC-67D50D14E304@thornhill.no> (message from Theodor Thornhill on Mon, 23 Jan 2023 22:08:27 +0100) References: <83tu0kkuqo.fsf@gnu.org> <87tu0k3y6t.fsf@thornhill.no> <83mt6ckqts.fsf@gnu.org> <87zgacgiwe.fsf@thornhill.no> <834jshhvjh.fsf@gnu.org> <806A8560-A675-423F-9CFC-67D50D14E304@thornhill.no> X-Spam-Score: -2.3 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > Date: Mon, 23 Jan 2023 22:08:27 +0100 > From: Theodor Thornhill > CC: bug-gnu-emacs@gnu.org > > > > On 23 January 2023 20:59:14 CET, Eli Zaretskii wrote: > >> From: Yuan Fu > >> Date: Mon, 23 Jan 2023 11:37:24 -0800 > >> Cc: Eli Zaretskii , > >> Bug Report Emacs > >> > >> Sorry for the delay, overall I agree with your changes. > > > >Thanks. What about the questions I asked regarding indentation > >features, and specifically about c-ts-mode-indent-style? > > I am working on that, but I hit some issues where I cannot make treesit recognize the new settings before the whole treesit-major-mode-setup reruns. Just setting the symbol doesn't work, and reenabling the mode inside of the :set function isn't the best idea maybe? > > I'd love some pointers to how other modes do similar stuff, but I didn't really find anything. Thanks, but can you add some details of what you are trying to do and what are the difficulties? Adding Stefan in case he has some advice. From unknown Sat Aug 16 12:45:36 2025 X-Loop: help-debbugs@gnu.org Subject: bug#60983: 29.0.60; Tree-sitter user-level control Resent-From: Theodor Thornhill Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 25 Jan 2023 20:14:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 60983 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Eli Zaretskii , Stefan Monnier Cc: casouri@gmail.com, 60983@debbugs.gnu.org X-Debbugs-Original-Cc: casouri@gmail.com, bug-gnu-emacs@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.167467759617222 (code B ref -1); Wed, 25 Jan 2023 20:14:01 +0000 Received: (at submit) by debbugs.gnu.org; 25 Jan 2023 20:13:16 +0000 Received: from localhost ([127.0.0.1]:60037 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pKm8y-0004Th-8c for submit@debbugs.gnu.org; Wed, 25 Jan 2023 15:13:16 -0500 Received: from lists.gnu.org ([209.51.188.17]:38652) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pKm8s-0004TU-Pv for submit@debbugs.gnu.org; Wed, 25 Jan 2023 15:13:14 -0500 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 1pKm8o-0002tu-ES for bug-gnu-emacs@gnu.org; Wed, 25 Jan 2023 15:13:06 -0500 Received: from out-213.mta0.migadu.com ([91.218.175.213]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pKm8l-0006bl-Qd for bug-gnu-emacs@gnu.org; Wed, 25 Jan 2023 15:13:06 -0500 X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=thornhill.no; s=key1; t=1674677575; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=kRp9xwVL5EeKdJ7aSSJEb+Hcb+OT0ZmBRg7XGgW4J/U=; b=HgF1QPjfeyOVhPmL3TE1evNKE2Z9ESKJTQ0b7BMyeNtpJTdZgGv6BZqDmbWG6u3JlNYSDW jbQZrlOofTRJpnLTyQj1SvvpT3uz0a0I1vAreUniymfHw6RZP3bwbTL0i+iwKRadpbnKs9 zfcRyYDWEGku62CuCeglSFJOuj4McdeBN3KJ3NyZyhsyjiVsl4Ksqam+v5efbPnd3RGvYM V5/omOKxWQHWQBQtTwEQ76T0aAaBMoJ1IkXZ4RyDMKx0tpk4nSZSur+lb0ChNtCpIpgxqd oRSzOPWkXXwMa19VaDMqHOpRyn5ew8e7711rcfh5rMyOIvw7YzNAzcL0Qg8Rig== From: Theodor Thornhill In-Reply-To: <833580ipdo.fsf@gnu.org> References: <83tu0kkuqo.fsf@gnu.org> <87tu0k3y6t.fsf@thornhill.no> <83mt6ckqts.fsf@gnu.org> <87zgacgiwe.fsf@thornhill.no> <834jshhvjh.fsf@gnu.org> <806A8560-A675-423F-9CFC-67D50D14E304@thornhill.no> <833580ipdo.fsf@gnu.org> Date: Wed, 25 Jan 2023 21:12:53 +0100 Message-ID: <87lelq8jay.fsf@thornhill.no> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Migadu-Flow: FLOW_OUT Received-SPF: pass client-ip=91.218.175.213; envelope-from=theo@thornhill.no; helo=out-213.mta0.migadu.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, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: -1.4 (-) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.4 (--) --=-=-= Content-Type: text/plain Eli Zaretskii writes: >> Date: Mon, 23 Jan 2023 22:08:27 +0100 >> From: Theodor Thornhill >> CC: bug-gnu-emacs@gnu.org >> >> >> >> On 23 January 2023 20:59:14 CET, Eli Zaretskii wrote: >> >> From: Yuan Fu >> >> Date: Mon, 23 Jan 2023 11:37:24 -0800 >> >> Cc: Eli Zaretskii , >> >> Bug Report Emacs >> >> >> >> Sorry for the delay, overall I agree with your changes. >> > >> >Thanks. What about the questions I asked regarding indentation >> >features, and specifically about c-ts-mode-indent-style? >> >> I am working on that, but I hit some issues where I cannot make treesit recognize the new settings before the whole treesit-major-mode-setup reruns. Just setting the symbol doesn't work, and reenabling the mode inside of the :set function isn't the best idea maybe? >> >> I'd love some pointers to how other modes do similar stuff, but I didn't really find anything. > > Thanks, but can you add some details of what you are trying to do and > what are the difficulties? > > Adding Stefan in case he has some advice. Ok, I added a patch below. try: 1. open some c buffer and make some edits, for example ``` void main() { if (x) { } } ``` This should be the expected output when using the gnu style. 2. M-x c-ts-mode-set-style "bsd" RET 3. C-h o c-ts-mode-indent-style RET Observe variable has changed, but indenting the code does not. 4 C-h o treesit-simple-indent-rules RET Observe variable keeps old value 5. C-x x g Now the bsd style takes effect, and the treesit-simple-indent-rules variable has changed. I'm sure the fix is easy, but I don't see it. I purposely kept the functions simple until I know what approach is best:) Thanks, Theo --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0001-Initial-c-ts-mode-set-style-attempt.patch >From 2a4948bb516435d11245256931eeb9cc0f562aba Mon Sep 17 00:00:00 2001 From: Theodor Thornhill Date: Wed, 25 Jan 2023 21:04:00 +0100 Subject: [PATCH] Initial c-ts-mode-set-style attempt --- lisp/progmodes/c-ts-mode.el | 45 +++++++++++++++++++++++++------------ 1 file changed, 31 insertions(+), 14 deletions(-) diff --git a/lisp/progmodes/c-ts-mode.el b/lisp/progmodes/c-ts-mode.el index 95f9001e0d..35f076b28d 100644 --- a/lisp/progmodes/c-ts-mode.el +++ b/lisp/progmodes/c-ts-mode.el @@ -92,7 +92,7 @@ c-ts-mode-indent-offset :safe 'integerp :group 'c) -(defcustom c-ts-mode-indent-style 'gnu +(defcustom c-ts-mode-indent-style "gnu" "Style used for indentation. The selected style could be one of GNU, K&R, LINUX or BSD. If @@ -100,13 +100,33 @@ c-ts-mode-indent-style set instead. This function is expected return a list that follows the form of `treesit-simple-indent-rules'." :version "29.1" - :type '(choice (symbol :tag "Gnu" 'gnu) - (symbol :tag "K&R" 'k&r) - (symbol :tag "Linux" 'linux) - (symbol :tag "BSD" 'bsd) + :type '(choice (string :tag "Gnu" "gnu") + (string :tag "K&R" "k&r") + (string :tag "Linux" "linux") + (string :tag "BSD" "bsd") (function :tag "A function for user customized style" ignore)) + :set #'c-ts-mode--indent-style :group 'c) +(defun c-ts-mode--indent-style (sym val) + "Custom setter for `c-ts-mode-indent-style'." + (set-default sym val)) + +(defun c-ts-mode-set-style () + (interactive) + (or (eq major-mode 'c-ts-mode) (eq major-mode 'c++-ts-mode) + (error "Buffer %s is not a c-ts-mode (c-ts-mode-set-style)" + (buffer-name))) + (if-let ((mode (cond ((eq major-mode 'c-ts-mode) 'c) + ((eq major-mode 'c++-ts-mode) 'cpp) + (t nil))) + (choice (completing-read "Select style: " '("gnu" "k&r" "linux" "bsd")))) + (c-ts-mode--indent-style 'c-ts-mode-indent-style choice) + (kill-local-variable 'treesit-simple-indent-rules) + (setq-local treesit-simple-indent-rules + (treesit--indent-rules-optimize + (c-ts-mode--set-indent-style mode))))) + ;;; Syntax table (defvar c-ts-mode--syntax-table @@ -224,19 +244,19 @@ c-ts-mode--indent-styles ((parent-is "do_statement") parent-bol c-ts-mode-indent-offset) ,@(when (eq mode 'cpp) `(((node-is "field_initializer_list") parent-bol ,(* c-ts-mode-indent-offset 2))))))) - `((gnu + `(("gnu" ;; Prepend rules to set highest priority ((match "while" "do_statement") parent 0) (c-ts-mode--top-level-label-matcher point-min 1) ,@common) - (k&r ,@common) - (linux + ("k&r" ,@common) + ("linux" ;; Reference: ;; https://www.kernel.org/doc/html/latest/process/coding-style.html, ;; and script/Lindent in Linux kernel repository. ((node-is "labeled_statement") point-min 0) ,@common) - (bsd + ("bsd" ((node-is "}") parent-bol 0) ((node-is "labeled_statement") parent-bol c-ts-mode-indent-offset) ((parent-is "labeled_statement") parent-bol c-ts-mode-indent-offset) @@ -255,11 +275,8 @@ c-ts-mode--set-indent-style (let ((style (if (functionp c-ts-mode-indent-style) (funcall c-ts-mode-indent-style) - (pcase c-ts-mode-indent-style - ('gnu (alist-get 'gnu (c-ts-mode--indent-styles mode))) - ('k&r (alist-get 'k&r (c-ts-mode--indent-styles mode))) - ('bsd (alist-get 'bsd (c-ts-mode--indent-styles mode))) - ('linux (alist-get 'linux (c-ts-mode--indent-styles mode))))))) + (alist-get c-ts-mode-indent-style + (c-ts-mode--indent-styles mode) nil nil #'equal)))) `((,mode ,@style)))) (defun c-ts-mode--top-level-label-matcher (node &rest _) -- 2.34.1 --=-=-=-- From unknown Sat Aug 16 12:45:36 2025 X-Loop: help-debbugs@gnu.org Subject: bug#60983: 29.0.60; Tree-sitter user-level control Resent-From: Stefan Monnier Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 25 Jan 2023 21:17:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 60983 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Theodor Thornhill Cc: eliz@gnu.org, 60983@debbugs.gnu.org, casouri@gmail.com X-Debbugs-Original-Cc: Eli Zaretskii , bug-gnu-emacs@gnu.org, casouri@gmail.com Received: via spool by submit@debbugs.gnu.org id=B.167468141223307 (code B ref -1); Wed, 25 Jan 2023 21:17:02 +0000 Received: (at submit) by debbugs.gnu.org; 25 Jan 2023 21:16:52 +0000 Received: from localhost ([127.0.0.1]:60099 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pKn8V-00063q-UF for submit@debbugs.gnu.org; Wed, 25 Jan 2023 16:16:52 -0500 Received: from lists.gnu.org ([209.51.188.17]:59454) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pKn8S-00063h-Gu for submit@debbugs.gnu.org; Wed, 25 Jan 2023 16:16:50 -0500 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 1pKn8R-0000Gk-Vp for bug-gnu-emacs@gnu.org; Wed, 25 Jan 2023 16:16:48 -0500 Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pKn8P-0000QG-Rr; Wed, 25 Jan 2023 16:16:47 -0500 Received: from pmg3.iro.umontreal.ca (localhost [127.0.0.1]) by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id 6404D443A9C; Wed, 25 Jan 2023 16:16:43 -0500 (EST) Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id 7CFB8443A96; Wed, 25 Jan 2023 16:16:34 -0500 (EST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1674681394; bh=QadmvehcZN1ubl00G1mbBXSwt0Yw9gpm57p3kWIImLI=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=mCybwPcnWILJSz6cPyKyfWYOFA/AAFbcQFIgdbWktXDzhpPLInScG6ZaufyIlpg4N CLVOdjRGvf7NId+9xbn06yZRNoAZRv8TBPAk7T5ZTr+EGK+SWSnMTDOjD3tIUv67G2 ISob4q8wICHseUh8Of+Yz7vIPhFvJRTs9MEWRGAtHTmULE3Qow6GrMgCA8HCsZFmgY pRpfi0XK1NfJ6a/AoiSOq0Kp11m0nI1lMqlluVwdy1tvybtMD3kG2G7taW8PGleW4Z 8ZVrNaZ1648gJj8dCAO3VY3myHh0NjdGPzQTlSbl1hxaX1oaRoFGCzbetXarKuiedz tmzJBYnJWV9LQ== Received: from pastel (unknown [45.72.216.69]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 522AE122514; Wed, 25 Jan 2023 16:16:34 -0500 (EST) From: Stefan Monnier In-Reply-To: <87lelq8jay.fsf@thornhill.no> (Theodor Thornhill's message of "Wed, 25 Jan 2023 21:12:53 +0100") Message-ID: References: <83tu0kkuqo.fsf@gnu.org> <87tu0k3y6t.fsf@thornhill.no> <83mt6ckqts.fsf@gnu.org> <87zgacgiwe.fsf@thornhill.no> <834jshhvjh.fsf@gnu.org> <806A8560-A675-423F-9CFC-67D50D14E304@thornhill.no> <833580ipdo.fsf@gnu.org> <87lelq8jay.fsf@thornhill.no> Date: Wed, 25 Jan 2023 16:16:33 -0500 User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain X-SPAM-INFO: Spam detection results: 0 ALL_TRUSTED -1 Passed through trusted hosts only via SMTP AWL -0.136 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DKIM_SIGNED 0.1 Message has a DKIM or DK signature, not necessarily valid DKIM_VALID -0.1 Message has at least one valid DKIM or DK signature DKIM_VALID_AU -0.1 Message has a valid DKIM or DK signature from author's domain X-SPAM-LEVEL: 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-Spam-Score: -1.3 (-) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.3 (--) > -(defcustom c-ts-mode-indent-style 'gnu > +(defcustom c-ts-mode-indent-style "gnu" > "Style used for indentation. > > The selected style could be one of GNU, K&R, LINUX or BSD. If > @@ -100,13 +100,33 @@ c-ts-mode-indent-style > set instead. This function is expected return a list that > follows the form of `treesit-simple-indent-rules'." > :version "29.1" > - :type '(choice (symbol :tag "Gnu" 'gnu) > - (symbol :tag "K&R" 'k&r) > - (symbol :tag "Linux" 'linux) > - (symbol :tag "BSD" 'bsd) > + :type '(choice (string :tag "Gnu" "gnu") > + (string :tag "K&R" "k&r") > + (string :tag "Linux" "linux") > + (string :tag "BSD" "bsd") > (function :tag "A function for user customized style" ignore)) > + :set #'c-ts-mode--indent-style > :group 'c) Why change to strings? BTW the previous code seems wrong: instead of (symbol :tag "FOO" 'foo) it should be (symbol :tag "FOO" foo) since `'foo` is not a symbol but a list (of two symbols). > +(defun c-ts-mode--indent-style (sym val) > + "Custom setter for `c-ts-mode-indent-style'." > + (set-default sym val)) Hmm... why bother use a `:set`ter if it doesn't do anything more than the default does? Shouldn't it call `treesit--indent-rules-optimize` to (re)set `treesit-simple-indent-rules`? [ Presumably in all relevant buffers, since the defcustom setting is global. ] > +(defun c-ts-mode-set-style () > + (interactive) > + (or (eq major-mode 'c-ts-mode) (eq major-mode 'c++-ts-mode) > + (error "Buffer %s is not a c-ts-mode (c-ts-mode-set-style)" > + (buffer-name))) > + (if-let ((mode (cond ((eq major-mode 'c-ts-mode) 'c) > + ((eq major-mode 'c++-ts-mode) 'cpp) > + (t nil))) > + (choice (completing-read "Select style: " '("gnu" "k&r" "linux" "bsd")))) Here, we probably want to specify `must-match` to `completing-read` (which makes it unnecessary to check `if-let`, I think) and we should provide a default. Also we should probably use the (c-ts-mode--indent-styles mode) alist rather than hardcode the set of styles. > + (c-ts-mode--indent-style 'c-ts-mode-indent-style choice) > + (kill-local-variable 'treesit-simple-indent-rules) > + (setq-local treesit-simple-indent-rules > + (treesit--indent-rules-optimize > + (c-ts-mode--set-indent-style mode))))) Here we presumably want to do the (setq-local treesit-simple-indent-rules ...) every time (and set `c-ts-mode-indent-style` buffer locally rather than via `c-ts-mode--indent-style`, or otherwise provide an additional arg to `c-ts-mode--indent-style` to say whether it applies globally or only to the current buffer). BTW, the naming of `c-ts-mode--indent-style` and `c-ts-mode--set-indent-style` is confusing. Also: why `kill-local-variable` just before the `setq-local`? > - (pcase c-ts-mode-indent-style > - ('gnu (alist-get 'gnu (c-ts-mode--indent-styles mode))) > - ('k&r (alist-get 'k&r (c-ts-mode--indent-styles mode))) > - ('bsd (alist-get 'bsd (c-ts-mode--indent-styles mode))) > - ('linux (alist-get 'linux (c-ts-mode--indent-styles mode))))))) > + (alist-get c-ts-mode-indent-style > + (c-ts-mode--indent-styles mode) nil nil #'equal)))) Thanks :-) Stefan From unknown Sat Aug 16 12:45:36 2025 X-Loop: help-debbugs@gnu.org Subject: bug#60983: 29.0.60; Tree-sitter user-level control Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 26 Jan 2023 06:09:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 60983 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Theodor Thornhill Cc: casouri@gmail.com, 60983@debbugs.gnu.org, monnier@iro.umontreal.ca X-Debbugs-Original-Cc: casouri@gmail.com, bug-gnu-emacs@gnu.org, monnier@iro.umontreal.ca Received: via spool by submit@debbugs.gnu.org id=B.167471330510927 (code B ref -1); Thu, 26 Jan 2023 06:09:02 +0000 Received: (at submit) by debbugs.gnu.org; 26 Jan 2023 06:08:25 +0000 Received: from localhost ([127.0.0.1]:60393 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pKvQu-0002qB-O9 for submit@debbugs.gnu.org; Thu, 26 Jan 2023 01:08:25 -0500 Received: from lists.gnu.org ([209.51.188.17]:56382) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pKvQp-0002pz-CV for submit@debbugs.gnu.org; Thu, 26 Jan 2023 01:08:23 -0500 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 1pKvQo-0003uD-Vg for bug-gnu-emacs@gnu.org; Thu, 26 Jan 2023 01:08:19 -0500 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 1pKvQo-0000aB-7s; Thu, 26 Jan 2023 01:08:18 -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=6Qkc1RXMAcYXR4ZV7vVWWjnQd5R1MWkVi0Q/yt4gl/Y=; b=claQExzJ4MdB BGo9AlqcrE0wl4lcHUmYAfVTw3JjKnyyDxp1tlsoLZ3YN9Ut68WYp+g96QOdCbJOoXbjhVbFhzto+ YJhxhQ7cTQq79jI4qAnTw4FrYRltZZK0zRHBWhQiLcgVDbrWD8n6p+6As6MdGA8hVXH7DL5NyXR0a xJzF1qVLbD56lR7i/n2bcgcq1CPNFIMZbIfQz2l2uDKJpEWerLvX3b6dXVz8ZzN8VDI20BV7uF+we PgcOobVOEGtXwKo0SseBxSiTBgE3QBV78KRBpEIyPpgAfk7KMnq1+2lC8YKqJRaU5yg9WuwmZXnYD CGhpl0mbfgc+Oc/gHccs/A==; 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 1pKvQn-000447-HW; Thu, 26 Jan 2023 01:08:17 -0500 Date: Thu, 26 Jan 2023 08:08:33 +0200 Message-Id: <83bkmlg74u.fsf@gnu.org> From: Eli Zaretskii In-Reply-To: <87lelq8jay.fsf@thornhill.no> (message from Theodor Thornhill on Wed, 25 Jan 2023 21:12:53 +0100) References: <83tu0kkuqo.fsf@gnu.org> <87tu0k3y6t.fsf@thornhill.no> <83mt6ckqts.fsf@gnu.org> <87zgacgiwe.fsf@thornhill.no> <834jshhvjh.fsf@gnu.org> <806A8560-A675-423F-9CFC-67D50D14E304@thornhill.no> <833580ipdo.fsf@gnu.org> <87lelq8jay.fsf@thornhill.no> X-Spam-Score: -2.3 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > From: Theodor Thornhill > Cc: casouri@gmail.com, bug-gnu-emacs@gnu.org > Date: Wed, 25 Jan 2023 21:12:53 +0100 > > > Adding Stefan in case he has some advice. > > Ok, I added a patch below. > > > try: > > 1. open some c buffer and make some edits, for example > ``` > void > main() > { > if (x) > { > } > } > ``` > > This should be the expected output when using the gnu style. > > 2. M-x c-ts-mode-set-style "bsd" RET > > 3. C-h o c-ts-mode-indent-style RET > Observe variable has changed, but indenting the code does not. > > 4 C-h o treesit-simple-indent-rules RET > Observe variable keeps old value > > 5. C-x x g > > Now the bsd style takes effect, and the treesit-simple-indent-rules > variable has changed. > > I'm sure the fix is easy, but I don't see it. I purposely kept the > functions simple until I know what approach is best:) Thanks, I'll wait until you adapt the changes to Stefan's comments, and try the new code then. If that doesn't fix the above problem, ask the question again at that time. From unknown Sat Aug 16 12:45:36 2025 X-Loop: help-debbugs@gnu.org Subject: bug#60983: 29.0.60; Tree-sitter user-level control Resent-From: Theodor Thornhill Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 26 Jan 2023 06:26:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 60983 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Eli Zaretskii Cc: casouri@gmail.com, 60983@debbugs.gnu.org, monnier@iro.umontreal.ca X-Debbugs-Original-Cc: casouri@gmail.com, bug-gnu-emacs@gnu.org, monnier@iro.umontreal.ca Received: via spool by submit@debbugs.gnu.org id=B.167471435712759 (code B ref -1); Thu, 26 Jan 2023 06:26:02 +0000 Received: (at submit) by debbugs.gnu.org; 26 Jan 2023 06:25:57 +0000 Received: from localhost ([127.0.0.1]:60403 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pKvhp-0003Jc-Gz for submit@debbugs.gnu.org; Thu, 26 Jan 2023 01:25:57 -0500 Received: from lists.gnu.org ([209.51.188.17]:44630) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pKvhl-0003JQ-Go for submit@debbugs.gnu.org; Thu, 26 Jan 2023 01:25:51 -0500 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 1pKvhl-0005Kh-Aa for bug-gnu-emacs@gnu.org; Thu, 26 Jan 2023 01:25:49 -0500 Received: from out-117.mta0.migadu.com ([2001:41d0:1004:224b::75]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pKvhj-0006qQ-4k for bug-gnu-emacs@gnu.org; Thu, 26 Jan 2023 01:25:48 -0500 Date: Thu, 26 Jan 2023 07:25:37 +0100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=thornhill.no; s=key1; t=1674714342; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ou5jrDbjHF2w8ztCkAW3xNoiqs4L+mX6x1qmXL/AtD0=; b=yIuircoriDYqr3xqtzsK1omGThLPnSSqpH6YSvwrRgSh8hop1E3Dn/VTup9i7bat2RvjiD rVWTPzVeliWjYbKRcCki3V2pbcbg4eRdJuUuyea+fYCwrBXq+PMmd9/W/jE7/sQuick4aP 52lSBaYGRmCHpysp60Blj8l2Z6WOVjTXmOkCoDJ3V2OVPg9p10AL5L+SYtC2QaV4H8bmJO hCiTCYqod4D04xupCx1gzXsRenek+9O9kVBx985EkNJ6erY//GAB11I7UEQwo0N8dlbiKY U3U0ZjU1m3omNts7bYBIFOM/bOlHl457qKEt+Qj2gOZGGT/BomJSJACWkncBJw== X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Theodor Thornhill In-Reply-To: <83bkmlg74u.fsf@gnu.org> References: <83tu0kkuqo.fsf@gnu.org> <87tu0k3y6t.fsf@thornhill.no> <83mt6ckqts.fsf@gnu.org> <87zgacgiwe.fsf@thornhill.no> <834jshhvjh.fsf@gnu.org> <806A8560-A675-423F-9CFC-67D50D14E304@thornhill.no> <833580ipdo.fsf@gnu.org> <87lelq8jay.fsf@thornhill.no> <83bkmlg74u.fsf@gnu.org> Message-ID: <2591E7A2-261F-462C-B865-D46B00C5DF7C@thornhill.no> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Migadu-Flow: FLOW_OUT Received-SPF: pass client-ip=2001:41d0:1004:224b::75; envelope-from=theo@thornhill.no; helo=out-117.mta0.migadu.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, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: -1.4 (-) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.1 (/) On 26 January 2023 07:08:33 CET, Eli Zaretskii wrote: >> From: Theodor Thornhill >> Cc: casouri@gmail=2Ecom, bug-gnu-emacs@gnu=2Eorg >> Date: Wed, 25 Jan 2023 21:12:53 +0100 >>=20 >> > Adding Stefan in case he has some advice=2E >>=20 >> Ok, I added a patch below=2E >>=20 >>=20 >> try: >>=20 >> 1=2E open some c buffer and make some edits, for example >> ``` >> void >> main() >> { >> if (x) >> { >> } >> } >> ``` >>=20 >> This should be the expected output when using the gnu style=2E >>=20 >> 2=2E M-x c-ts-mode-set-style "bsd" RET >>=20 >> 3=2E C-h o c-ts-mode-indent-style RET >> Observe variable has changed, but indenting the code does not=2E >>=20 >> 4 C-h o treesit-simple-indent-rules RET >> Observe variable keeps old value >>=20 >> 5=2E C-x x g >>=20 >> Now the bsd style takes effect, and the treesit-simple-indent-rules >> variable has changed=2E >>=20 >> I'm sure the fix is easy, but I don't see it=2E I purposely kept the >> functions simple until I know what approach is best:) > >Thanks, I'll wait until you adapt the changes to Stefan's comments, >and try the new code then=2E If that doesn't fix the above problem, ask >the question again at that time=2E Yeah, thanks both :) Theo From unknown Sat Aug 16 12:45:36 2025 X-Loop: help-debbugs@gnu.org Subject: bug#60983: 29.0.60; Tree-sitter user-level control Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 26 Jan 2023 07:28:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 60983 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: casouri@gmail.com, theo@thornhill.no Cc: 60983@debbugs.gnu.org Received: via spool by 60983-submit@debbugs.gnu.org id=B60983.167471807419768 (code B ref 60983); Thu, 26 Jan 2023 07:28:02 +0000 Received: (at 60983) by debbugs.gnu.org; 26 Jan 2023 07:27:54 +0000 Received: from localhost ([127.0.0.1]:60491 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pKwfp-00058l-Qj for submit@debbugs.gnu.org; Thu, 26 Jan 2023 02:27:54 -0500 Received: from eggs.gnu.org ([209.51.188.92]:44704) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pKwfk-00058V-NK for 60983@debbugs.gnu.org; Thu, 26 Jan 2023 02:27:52 -0500 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 1pKwfe-0002Ch-43; Thu, 26 Jan 2023 02:27:42 -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=ZKTkLm/GTIH83lKmFKJLyYLEBjmmVoS1hgKeqsbZRZw=; b=nWlGYlfQzZq4 07jSi0VqH8aiPyvKC3tPy90jNYt5s+RZBSzNNEKdlX4NraxTFcIV6GWdELjkkVhbKbSieLK7hYjua tSHUkbGJ48klMuUGdFnBLnUMIs6lh9lVahpGVyr/kk2x0p4n6rj5yB1g9X7m34l4+Q+LGrODJq+Oy IoWDhxxQ9k4CeEepXRZy0kGxWL6IWRvnymVC5rZtHi7cM4jlqq4PoeOJUo/q6KtmfJLdwgZy069n4 y45LZuglRaLrCMUJbQAQTyFFeMx5fyO13Q1pf5SB8UZG9ZlRYs5uJx0ahIU9mY46whrrTFcXzlHkw T6zpcReFClRWMZbYYwV3IQ==; 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 1pKwfS-0005J3-Qh; Thu, 26 Jan 2023 02:27:41 -0500 Date: Thu, 26 Jan 2023 09:27:46 +0200 Message-Id: <83357xg3gt.fsf@gnu.org> From: Eli Zaretskii In-Reply-To: <83edrli46m.fsf@gnu.org> (message from Eli Zaretskii on Mon, 23 Jan 2023 18:52:33 +0200) References: <83tu0kkuqo.fsf@gnu.org> <87tu0k3y6t.fsf@thornhill.no> <83edrli46m.fsf@gnu.org> X-Spam-Score: -2.3 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > Cc: 60983@debbugs.gnu.org, theo@thornhill.no > Date: Mon, 23 Jan 2023 18:52:33 +0200 > From: Eli Zaretskii > > > 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). > > ``` 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 From unknown Sat Aug 16 12:45:36 2025 X-Loop: help-debbugs@gnu.org Subject: bug#60983: 29.0.60; Tree-sitter user-level control Resent-From: Theodor Thornhill Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 26 Jan 2023 07:38:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 60983 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Eli Zaretskii , casouri@gmail.com Cc: 60983@debbugs.gnu.org Received: via spool by 60983-submit@debbugs.gnu.org id=B60983.167471866820738 (code B ref 60983); Thu, 26 Jan 2023 07:38:02 +0000 Received: (at 60983) by debbugs.gnu.org; 26 Jan 2023 07:37:48 +0000 Received: from localhost ([127.0.0.1]:60506 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pKwpP-0005OQ-QJ for submit@debbugs.gnu.org; Thu, 26 Jan 2023 02:37:48 -0500 Received: from out0.migadu.com ([94.23.1.103]:38379) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pKwpN-0005OH-QC for 60983@debbugs.gnu.org; Thu, 26 Jan 2023 02:37:46 -0500 X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=thornhill.no; s=key1; t=1674718664; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=TrvJhdVMiqLsOynXpOh1diQofhf/cMhND50IHo95UBg=; b=P3LUJOyGWngUaaFlNBnvbAQR8LNUTc8UXD9kI0ZBwPUqhFmZUNH8whx1YBuHS9GkB0PWlo kMzsfA+0QIoNLjI0Xe0Z5qLiyvFEDsFzZ0ezHkAUoiGe7d6smBUOsYbEQIqzah7wfDMVPO uBBH/dIXWhioBNclVYoxRn4pYWk7lsAqlFvRA/0Sp5Kk72mWetOh9BAVOK2S51gdSrXqyD Ma+PXG436lYb96QhLSVgvxLeNRaTjXl/QNzGbNOPrTc/IeBMlVIyGJNx9DSq4yuWnnnILo h6MvmFwMBQdatJxRI9AZwEgL4c2hdhPNtkGIpnYFviOkO1Kp6Klk+Ax6q8K1BA== From: Theodor Thornhill In-Reply-To: <83357xg3gt.fsf@gnu.org> References: <83tu0kkuqo.fsf@gnu.org> <87tu0k3y6t.fsf@thornhill.no> <83edrli46m.fsf@gnu.org> <83357xg3gt.fsf@gnu.org> Date: Thu, 26 Jan 2023 08:37:42 +0100 Message-ID: <87bkmlhhkp.fsf@thornhill.no> MIME-Version: 1.0 Content-Type: text/plain X-Migadu-Flow: FLOW_OUT X-Spam-Score: -0.7 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) Eli Zaretskii writes: >> Cc: 60983@debbugs.gnu.org, theo@thornhill.no >> Date: Mon, 23 Jan 2023 18:52:33 +0200 >> From: Eli Zaretskii >> >> > 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). >> > ``` > > 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 From unknown Sat Aug 16 12:45:36 2025 X-Loop: help-debbugs@gnu.org Subject: bug#60983: 29.0.60; Tree-sitter user-level control References: <83tu0kkuqo.fsf@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 X-GNU-PR-Keywords: To: Theodor Thornhill Cc: Eli Zaretskii , 60983@debbugs.gnu.org Received: via spool by 60983-submit@debbugs.gnu.org id=B60983.167471978422842 (code B ref 60983); Thu, 26 Jan 2023 07:57:02 +0000 Received: (at 60983) by debbugs.gnu.org; 26 Jan 2023 07:56:24 +0000 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 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 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) 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) From: Yuan Fu Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3731.300.101.1.3\)) Message-Id: <3CCA0C80-F37A-4F4F-9556-F6C7610762F9@gmail.com> Date: Wed, 25 Jan 2023 23:56:03 -0800 X-Mailer: Apple Mail (2.3731.300.101.1.3) X-Spam-Score: 0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) 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 From unknown Sat Aug 16 12:45:36 2025 X-Loop: help-debbugs@gnu.org Subject: bug#60983: 29.0.60; Tree-sitter user-level control Resent-From: Theodor Thornhill Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 26 Jan 2023 08:28:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 60983 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Stefan Monnier Cc: eliz@gnu.org, 60983@debbugs.gnu.org, casouri@gmail.com X-Debbugs-Original-Cc: Eli Zaretskii , bug-gnu-emacs@gnu.org, casouri@gmail.com Received: via spool by submit@debbugs.gnu.org id=B.167472167526474 (code B ref -1); Thu, 26 Jan 2023 08:28:01 +0000 Received: (at submit) by debbugs.gnu.org; 26 Jan 2023 08:27:55 +0000 Received: from localhost ([127.0.0.1]:60643 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pKxbu-0006sv-Go for submit@debbugs.gnu.org; Thu, 26 Jan 2023 03:27:55 -0500 Received: from lists.gnu.org ([209.51.188.17]:47474) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pKxbr-0006sl-PZ for submit@debbugs.gnu.org; Thu, 26 Jan 2023 03:27:52 -0500 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 1pKxbp-0003wh-3Z for bug-gnu-emacs@gnu.org; Thu, 26 Jan 2023 03:27:50 -0500 Received: from out2.migadu.com ([2001:41d0:2:aacc::]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pKxbj-0003mg-Ks; Thu, 26 Jan 2023 03:27:47 -0500 X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=thornhill.no; s=key1; t=1674721660; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=iFYoQXmOI5y7c1tjwzvXVUcLhzdg9e3r2IDugBgRlDc=; b=aUpiiy4wrRPEn/psokg270+a6dAQOzvy7ptJN9+H6CZUZTUAHz3fJz5GtNcn6X4M0baphR UArV71S+paE+n+FlxPp6+2srBA0fWu7DPqoyMFnMQ9NqIlyZfgjf34vTKxQC0M1CQkUzbU CnH7NAYxXbE1F4XWJd48mHhOqRb497FDh7aChz8ni6EtjTp0tH2e7OTK1dDpcHFi3glTXi buPLrjqfdWYQ0WJ4s5NErjyDHClB32jMFaqRQtchuV2dxhFL76MRbI/29lSb8lwnJqMHDS FxvYZTxU1ZNJ4Q0ArlfEhN3F837g/fBJXQp90Ayz6Jrj5/1ORoA10UlF2ZoLOA== From: Theodor Thornhill In-Reply-To: References: <83tu0kkuqo.fsf@gnu.org> <87tu0k3y6t.fsf@thornhill.no> <83mt6ckqts.fsf@gnu.org> <87zgacgiwe.fsf@thornhill.no> <834jshhvjh.fsf@gnu.org> <806A8560-A675-423F-9CFC-67D50D14E304@thornhill.no> <833580ipdo.fsf@gnu.org> <87lelq8jay.fsf@thornhill.no> Date: Thu, 26 Jan 2023 09:27:38 +0100 Message-ID: <875ycthf9h.fsf@thornhill.no> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Migadu-Flow: FLOW_OUT Received-SPF: pass client-ip=2001:41d0:2:aacc::; envelope-from=theo@thornhill.no; helo=out2.migadu.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 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, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: -1.4 (-) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.4 (--) --=-=-= Content-Type: text/plain Stefan Monnier writes: >> -(defcustom c-ts-mode-indent-style 'gnu >> +(defcustom c-ts-mode-indent-style "gnu" >> "Style used for indentation. >> >> The selected style could be one of GNU, K&R, LINUX or BSD. If >> @@ -100,13 +100,33 @@ c-ts-mode-indent-style >> set instead. This function is expected return a list that >> follows the form of `treesit-simple-indent-rules'." >> :version "29.1" >> - :type '(choice (symbol :tag "Gnu" 'gnu) >> - (symbol :tag "K&R" 'k&r) >> - (symbol :tag "Linux" 'linux) >> - (symbol :tag "BSD" 'bsd) >> + :type '(choice (string :tag "Gnu" "gnu") >> + (string :tag "K&R" "k&r") >> + (string :tag "Linux" "linux") >> + (string :tag "BSD" "bsd") >> (function :tag "A function for user customized style" ignore)) >> + :set #'c-ts-mode--indent-style >> :group 'c) > > Why change to strings? > BTW the previous code seems wrong: instead of > > (symbol :tag "FOO" 'foo) > > it should be > > (symbol :tag "FOO" foo) > > since `'foo` is not a symbol but a list (of two symbols). > Thanks, fixed. >> +(defun c-ts-mode--indent-style (sym val) >> + "Custom setter for `c-ts-mode-indent-style'." >> + (set-default sym val)) > > Hmm... why bother use a `:set`ter if it doesn't do anything more than > the default does? > Shouldn't it call `treesit--indent-rules-optimize` to (re)set > `treesit-simple-indent-rules`? > [ Presumably in all relevant buffers, since the defcustom setting is > global. ] > Thanks, done. >> +(defun c-ts-mode-set-style () >> + (interactive) >> + (or (eq major-mode 'c-ts-mode) (eq major-mode 'c++-ts-mode) >> + (error "Buffer %s is not a c-ts-mode (c-ts-mode-set-style)" >> + (buffer-name))) >> + (if-let ((mode (cond ((eq major-mode 'c-ts-mode) 'c) >> + ((eq major-mode 'c++-ts-mode) 'cpp) >> + (t nil))) >> + (choice (completing-read "Select style: " '("gnu" "k&r" "linux" "bsd")))) > > Here, we probably want to specify `must-match` to `completing-read` > (which makes it unnecessary to check `if-let`, I think) and we should > provide a default. > Also we should probably use the (c-ts-mode--indent-styles mode) alist > rather than hardcode the set of styles. > >> + (c-ts-mode--indent-style 'c-ts-mode-indent-style choice) >> + (kill-local-variable 'treesit-simple-indent-rules) >> + (setq-local treesit-simple-indent-rules >> + (treesit--indent-rules-optimize >> + (c-ts-mode--set-indent-style mode))))) > > Here we presumably want to do the (setq-local > treesit-simple-indent-rules ...) every time (and set > `c-ts-mode-indent-style` buffer locally rather than via > `c-ts-mode--indent-style`, or otherwise provide an additional arg to > `c-ts-mode--indent-style` to say whether it applies globally or only to > the current buffer). > > BTW, the naming of `c-ts-mode--indent-style` and > `c-ts-mode--set-indent-style` is confusing. > > Also: why `kill-local-variable` just before the `setq-local`? > >> - (pcase c-ts-mode-indent-style >> - ('gnu (alist-get 'gnu (c-ts-mode--indent-styles mode))) >> - ('k&r (alist-get 'k&r (c-ts-mode--indent-styles mode))) >> - ('bsd (alist-get 'bsd (c-ts-mode--indent-styles mode))) >> - ('linux (alist-get 'linux (c-ts-mode--indent-styles mode))))))) >> + (alist-get c-ts-mode-indent-style >> + (c-ts-mode--indent-styles mode) nil nil #'equal)))) > > Thanks :-) > > > Stefan Does this patch look better? It also works, now :) Theo --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0001-Initial-c-ts-mode-set-style-attempt.patch >From 49b135580ba3d60b2f77dada99a1adc4c64ef9b2 Mon Sep 17 00:00:00 2001 From: Theodor Thornhill Date: Wed, 25 Jan 2023 21:04:00 +0100 Subject: [PATCH] Initial c-ts-mode-set-style attempt --- lisp/progmodes/c-ts-mode.el | 47 ++++++++++++++++++++++++++++++------- 1 file changed, 38 insertions(+), 9 deletions(-) diff --git a/lisp/progmodes/c-ts-mode.el b/lisp/progmodes/c-ts-mode.el index 95f9001e0d..0585795f35 100644 --- a/lisp/progmodes/c-ts-mode.el +++ b/lisp/progmodes/c-ts-mode.el @@ -92,6 +92,25 @@ c-ts-mode-indent-offset :safe 'integerp :group 'c) +(defun c-ts-mode--indent-style-setter (sym val) + "Custom setter for `c-ts-mode-set-style'." + (named-let loop ((res nil) + (buffers (buffer-list))) + (if (null buffers) + (mapc (lambda (b) + (with-current-buffer b + (set-default sym val) + (setq-local treesit-simple-indent-rules + (treesit--indent-rules-optimize + (c-ts-mode--set-indent-style + (if (eq major-mode 'c-ts-mode) 'c 'cpp)))))) + res) + (let ((buffer (car buffers))) + (with-current-buffer buffer + (if (or (eq major-mode 'c-ts-mode) (eq major-mode 'c++-ts-mode)) + (loop (append res (list buffer)) (cdr buffers)) + (loop res (cdr buffers)))))))) + (defcustom c-ts-mode-indent-style 'gnu "Style used for indentation. @@ -100,13 +119,27 @@ c-ts-mode-indent-style set instead. This function is expected return a list that follows the form of `treesit-simple-indent-rules'." :version "29.1" - :type '(choice (symbol :tag "Gnu" 'gnu) - (symbol :tag "K&R" 'k&r) - (symbol :tag "Linux" 'linux) - (symbol :tag "BSD" 'bsd) + :type '(choice (symbol :tag "Gnu" gnu) + (symbol :tag "K&R" k&r) + (symbol :tag "Linux" linux) + (symbol :tag "BSD" bsd) (function :tag "A function for user customized style" ignore)) + :set #'c-ts-mode--indent-style-setter :group 'c) +(defun c-ts-mode-set-style () + (interactive) + (or (eq major-mode 'c-ts-mode) (eq major-mode 'c++-ts-mode) + (error "Buffer %s is not a c-ts-mode (c-ts-mode-set-style)" + (buffer-name))) + (c-ts-mode--indent-style-setter + 'c-ts-mode-indent-style + (intern + (completing-read + "Select style: " + (mapcar #'car (c-ts-mode--indent-styles (if (eq major-mode 'c-ts-mode) 'c 'cpp))) + nil t nil nil "gnu")))) + ;;; Syntax table (defvar c-ts-mode--syntax-table @@ -255,11 +288,7 @@ c-ts-mode--set-indent-style (let ((style (if (functionp c-ts-mode-indent-style) (funcall c-ts-mode-indent-style) - (pcase c-ts-mode-indent-style - ('gnu (alist-get 'gnu (c-ts-mode--indent-styles mode))) - ('k&r (alist-get 'k&r (c-ts-mode--indent-styles mode))) - ('bsd (alist-get 'bsd (c-ts-mode--indent-styles mode))) - ('linux (alist-get 'linux (c-ts-mode--indent-styles mode))))))) + (alist-get c-ts-mode-indent-style (c-ts-mode--indent-styles mode))))) `((,mode ,@style)))) (defun c-ts-mode--top-level-label-matcher (node &rest _) -- 2.34.1 --=-=-=-- From unknown Sat Aug 16 12:45:36 2025 X-Loop: help-debbugs@gnu.org Subject: bug#60983: 29.0.60; Tree-sitter user-level control Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 26 Jan 2023 09:08:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 60983 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Theodor Thornhill Cc: casouri@gmail.com, 60983@debbugs.gnu.org Received: via spool by 60983-submit@debbugs.gnu.org id=B60983.167472407430791 (code B ref 60983); Thu, 26 Jan 2023 09:08:02 +0000 Received: (at 60983) by debbugs.gnu.org; 26 Jan 2023 09:07:54 +0000 Received: from localhost ([127.0.0.1]:60699 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pKyEc-00080Z-2b for submit@debbugs.gnu.org; Thu, 26 Jan 2023 04:07:54 -0500 Received: from eggs.gnu.org ([209.51.188.92]:53030) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pKyEY-00080I-W7 for 60983@debbugs.gnu.org; Thu, 26 Jan 2023 04:07:53 -0500 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 1pKyES-00034Z-ND; Thu, 26 Jan 2023 04:07:45 -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=aAfm87crQ474NYyPE+HOAfPm0PrRnGKglwQKQXPuWN4=; b=Zr8iSNluvYQ+ ekkOS46jt1qRX6b4gD5SCLqEOdGpBzuBBBjrE71IQ7wn10aeZz2d420VWPpo8BtuBxUv/fe8Z7sps 22aNpTVZw3UQPL7oiMqoG4dubjfi26bvkyKy6mLG7VqbzxY5OG2OkDccmkw/V+Y5KOjQW/LSNvhgz t82QTJtXbHcTZrZZRRROaOq9XGB9vNvYAGL52dFtcBohm83hjxFELjX1Y/8wiTs4EGVqlRWZoXgW9 ELH/n0mQPcmNymaW3V0SFEFChEtd2KI52ncMdTm/W74EE0S1XsEWAqQnCqn3ESYWhN4QLreY4Y4Sp USHyeBekgtnZsER4hwOBqA==; 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 1pKyES-0002Hh-5Q; Thu, 26 Jan 2023 04:07:44 -0500 Date: Thu, 26 Jan 2023 11:08:00 +0200 Message-Id: <83h6wdek9b.fsf@gnu.org> From: Eli Zaretskii In-Reply-To: <87bkmlhhkp.fsf@thornhill.no> (message from Theodor Thornhill on Thu, 26 Jan 2023 08:37:42 +0100) References: <83tu0kkuqo.fsf@gnu.org> <87tu0k3y6t.fsf@thornhill.no> <83edrli46m.fsf@gnu.org> <83357xg3gt.fsf@gnu.org> <87bkmlhhkp.fsf@thornhill.no> X-Spam-Score: -2.3 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > From: Theodor Thornhill > Cc: 60983@debbugs.gnu.org > Date: Thu, 26 Jan 2023 08:37:42 +0100 > > Eli Zaretskii writes: > > > 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 :) Thanks! From unknown Sat Aug 16 12:45:36 2025 X-Loop: help-debbugs@gnu.org Subject: bug#60983: 29.0.60; Tree-sitter user-level control Resent-From: Theodor Thornhill Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 28 Jan 2023 13:14:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 60983 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Eli Zaretskii , casouri@gmail.com Cc: 60983@debbugs.gnu.org Received: via spool by 60983-submit@debbugs.gnu.org id=B60983.167491158226566 (code B ref 60983); Sat, 28 Jan 2023 13:14:01 +0000 Received: (at 60983) by debbugs.gnu.org; 28 Jan 2023 13:13:02 +0000 Received: from localhost ([127.0.0.1]:39871 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pLl0v-0006uE-EE for submit@debbugs.gnu.org; Sat, 28 Jan 2023 08:13:02 -0500 Received: from out0.migadu.com ([94.23.1.103]:18238) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pLl0r-0006ty-Di for 60983@debbugs.gnu.org; Sat, 28 Jan 2023 08:12:59 -0500 X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=thornhill.no; s=key1; t=1674911575; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=ZIKydZxijkrq5FzxEROinZTfVxHOVooyGKqtUM+Iy7Q=; b=C0HWUnpGpREHsrRVyS0qVa5Bt2rvcbKr2Vez4DWhZlhMhvpN6loMa+JVALrbgvXYwpgRac mWX9GSTM0GPoFMHv7Rn1VWEXJiehn5OxlSCit4OjnKmceVcG41HiIumBskKFU/PLzPEfYA NqCrIlHz6vtC43dDu/ghd3JktOc1GN3X/KoJSS/IzUo5btAc27Nd8mD1beQ35FW+zXlTOG r/iYtfylNCgdG83MEa9vem0g0hGOJRLhczdaWmhy8eT6DFqNnX5qmIBGIFdPVn0ZE7eP+/ 9aKrNjfFJaDd+TCkVaFbnBzRTH+NKmasg+iYY5YcwmMHCoZL7z8d+UpxqhEZgA== From: Theodor Thornhill In-Reply-To: <83357xg3gt.fsf@gnu.org> References: <83tu0kkuqo.fsf@gnu.org> <87tu0k3y6t.fsf@thornhill.no> <83edrli46m.fsf@gnu.org> <83357xg3gt.fsf@gnu.org> Date: Sat, 28 Jan 2023 14:12:52 +0100 Message-ID: <871qnessyz.fsf@thornhill.no> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Migadu-Flow: FLOW_OUT X-Spam-Score: -0.7 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) --=-=-= Content-Type: text/plain Eli Zaretskii writes: >> Cc: 60983@debbugs.gnu.org, theo@thornhill.no >> Date: Mon, 23 Jan 2023 18:52:33 +0200 >> From: Eli Zaretskii >> >> > 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). >> > ``` > > 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 Are you okay with these patches, Eli? If so, then I can clean them up a little and install on emacs-29. In both cases using (customize-set-variable 'the-variable val) will take effect in the buffer without having to reload anything. Let me know if there are any other changes needed. I'll have some time this evening to do some hacking if needed :) Thanks, Theo --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0001-Initial-c-ts-mode-set-style-attempt.patch >From 3a5352536ef3a511cbdcc34b9e6e257ff1d36d83 Mon Sep 17 00:00:00 2001 From: Theodor Thornhill Date: Wed, 25 Jan 2023 21:04:00 +0100 Subject: [PATCH] Initial c-ts-mode-set-style attempt --- lisp/progmodes/c-ts-mode.el | 47 ++++++++++++++++++++++++++++++------- 1 file changed, 38 insertions(+), 9 deletions(-) diff --git a/lisp/progmodes/c-ts-mode.el b/lisp/progmodes/c-ts-mode.el index eb2be9b792..9834428a06 100644 --- a/lisp/progmodes/c-ts-mode.el +++ b/lisp/progmodes/c-ts-mode.el @@ -92,6 +92,25 @@ c-ts-mode-indent-offset :safe 'integerp :group 'c) +(defun c-ts-mode--indent-style-setter (sym val) + "Custom setter for `c-ts-mode-set-style'." + (named-let loop ((res nil) + (buffers (buffer-list))) + (if (null buffers) + (mapc (lambda (b) + (with-current-buffer b + (set-default sym val) + (setq-local treesit-simple-indent-rules + (treesit--indent-rules-optimize + (c-ts-mode--set-indent-style + (if (eq major-mode 'c-ts-mode) 'c 'cpp)))))) + res) + (let ((buffer (car buffers))) + (with-current-buffer buffer + (if (or (eq major-mode 'c-ts-mode) (eq major-mode 'c++-ts-mode)) + (loop (append res (list buffer)) (cdr buffers)) + (loop res (cdr buffers)))))))) + (defcustom c-ts-mode-indent-style 'gnu "Style used for indentation. @@ -100,13 +119,27 @@ c-ts-mode-indent-style set instead. This function is expected return a list that follows the form of `treesit-simple-indent-rules'." :version "29.1" - :type '(choice (symbol :tag "Gnu" 'gnu) - (symbol :tag "K&R" 'k&r) - (symbol :tag "Linux" 'linux) - (symbol :tag "BSD" 'bsd) + :type '(choice (symbol :tag "Gnu" gnu) + (symbol :tag "K&R" k&r) + (symbol :tag "Linux" linux) + (symbol :tag "BSD" bsd) (function :tag "A function for user customized style" ignore)) + :set #'c-ts-mode--indent-style-setter :group 'c) +(defun c-ts-mode-set-style () + (interactive) + (or (eq major-mode 'c-ts-mode) (eq major-mode 'c++-ts-mode) + (error "Buffer %s is not a c-ts-mode (c-ts-mode-set-style)" + (buffer-name))) + (c-ts-mode--indent-style-setter + 'c-ts-mode-indent-style + (intern + (completing-read + "Select style: " + (mapcar #'car (c-ts-mode--indent-styles (if (eq major-mode 'c-ts-mode) 'c 'cpp))) + nil t nil nil "gnu")))) + ;;; Syntax table (defvar c-ts-mode--syntax-table @@ -255,11 +288,7 @@ c-ts-mode--set-indent-style (let ((style (if (functionp c-ts-mode-indent-style) (funcall c-ts-mode-indent-style) - (pcase c-ts-mode-indent-style - ('gnu (alist-get 'gnu (c-ts-mode--indent-styles mode))) - ('k&r (alist-get 'k&r (c-ts-mode--indent-styles mode))) - ('bsd (alist-get 'bsd (c-ts-mode--indent-styles mode))) - ('linux (alist-get 'linux (c-ts-mode--indent-styles mode))))))) + (alist-get c-ts-mode-indent-style (c-ts-mode--indent-styles mode))))) `((,mode ,@style)))) (defun c-ts-mode--top-level-label-matcher (node &rest _) -- 2.34.1 --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0001-Make-treesit-font-lock-level-a-defcustom.patch >From ead69b71c3d4e0ea86119f5d9ec201596cf6d34d Mon Sep 17 00:00:00 2001 From: Theodor Thornhill Date: Sat, 28 Jan 2023 13:57:01 +0100 Subject: [PATCH] Make treesit-font-lock-level a defcustom * lisp/treesit.el (treesit--font-lock-level-setter): Setter for the new defcustom. (treesit-font-lock-level): Turn it into a defcustom. --- lisp/treesit.el | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/lisp/treesit.el b/lisp/treesit.el index 4c9bdfc0bd..363692eabd 100644 --- a/lisp/treesit.el +++ b/lisp/treesit.el @@ -554,7 +554,25 @@ 'treesit-font-lock-error "Generic tree-sitter font-lock error" 'treesit-error) -(defvar-local treesit-font-lock-level 3 +(defun treesit--font-lock-level-setter (sym val) + "Custom setter for `treesit-font-lock-level'." + (set-default sym val) + (named-let loop ((res nil) + (buffers (buffer-list))) + (if (null buffers) + (mapc (lambda (b) + (with-current-buffer b + (setq-local treesit-font-lock-level val) + (treesit-font-lock-recompute-features) + (treesit-font-lock-fontify-region (point-min) (point-max)))) + res) + (let ((buffer (car buffers))) + (with-current-buffer buffer + (if (treesit-parser-list) + (loop (append res (list buffer)) (cdr buffers)) + (loop res (cdr buffers)))))))) + +(defcustom treesit-font-lock-level 3 "Decoration level to be used by tree-sitter fontifications. Major modes categorize their fontification features into levels, @@ -571,7 +589,10 @@ treesit-font-lock-level In addition to the decoration level, individual features can be turned on/off by calling `treesit-font-lock-recompute-features'. Changing the decoration level requires calling -`treesit-font-lock-recompute-features' to have an effect.") +`treesit-font-lock-recompute-features' to have an effect." + :type 'integer + :set #'treesit--font-lock-level-setter + :version "29.1") (defvar-local treesit--font-lock-query-expand-range (cons 0 0) "The amount to expand the start and end of the region when fontifying. -- 2.34.1 --=-=-=-- From unknown Sat Aug 16 12:45:36 2025 X-Loop: help-debbugs@gnu.org Subject: bug#60983: 29.0.60; Tree-sitter user-level control Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 28 Jan 2023 13:27:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 60983 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Theodor Thornhill Cc: casouri@gmail.com, 60983@debbugs.gnu.org Received: via spool by 60983-submit@debbugs.gnu.org id=B60983.167491237027781 (code B ref 60983); Sat, 28 Jan 2023 13:27:02 +0000 Received: (at 60983) by debbugs.gnu.org; 28 Jan 2023 13:26:10 +0000 Received: from localhost ([127.0.0.1]:39886 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pLlDe-0007E0-AS for submit@debbugs.gnu.org; Sat, 28 Jan 2023 08:26:10 -0500 Received: from eggs.gnu.org ([209.51.188.92]:56560) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pLlDd-0007Dp-4M for 60983@debbugs.gnu.org; Sat, 28 Jan 2023 08:26:09 -0500 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 1pLlDX-0001Hx-JP; Sat, 28 Jan 2023 08:26:03 -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=6InpQjMsYx0mNHEcRflnmRTsW4xwaEXxHicmDI077ec=; b=PMF82kIUIPg/ iZQkAdvfV2X+ekukMpyHuOMgb7zfu9iLU2vPaFcZ7MQSBoslpf1df73pUwqCwYA2RaIdekKwD0zdR kAEHcst+XtEEiifSLwqV4aY4PVqUsPu7dsMxd4kCuKVK0/xlZwgjtXf55a0+J/OduSdklWSzHYM83 L2LF+aTjaQZeSSeHilyPC0mj9V8tDmspf7OWlv00iJVBOdoUlYcsxfuPyI/OAcmLAbEjOlsLWwBak W7beksNyl91lVAE6hsUJmHHvx1tZoF+6jMhccaMDvyx45PTCzaDyRc19IxSg7uXChrqsSbcC0xPru QNptleSa6by8H3DoGaIwzg==; 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 1pLlDW-0007Xn-SR; Sat, 28 Jan 2023 08:26:03 -0500 Date: Sat, 28 Jan 2023 15:25:50 +0200 Message-Id: <83k016aizl.fsf@gnu.org> From: Eli Zaretskii In-Reply-To: <871qnessyz.fsf@thornhill.no> (message from Theodor Thornhill on Sat, 28 Jan 2023 14:12:52 +0100) References: <83tu0kkuqo.fsf@gnu.org> <87tu0k3y6t.fsf@thornhill.no> <83edrli46m.fsf@gnu.org> <83357xg3gt.fsf@gnu.org> <871qnessyz.fsf@thornhill.no> X-Spam-Score: -2.3 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > From: Theodor Thornhill > Cc: 60983@debbugs.gnu.org > Date: Sat, 28 Jan 2023 14:12:52 +0100 > > > 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 > > > Are you okay with these patches, Eli? If so, then I can clean them up a > little and install on emacs-29. In both cases using > (customize-set-variable 'the-variable val) will take effect in the > buffer without having to reload anything. LGTM, please install, and thanks. > Let me know if there are any other changes needed. I'll have some time > this evening to do some hacking if needed :) Will do. From unknown Sat Aug 16 12:45:36 2025 X-Loop: help-debbugs@gnu.org Subject: bug#60983: 29.0.60; Tree-sitter user-level control Resent-From: Theodor Thornhill Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 28 Jan 2023 18:42:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 60983 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Eli Zaretskii Cc: casouri@gmail.com, 60983@debbugs.gnu.org Received: via spool by 60983-submit@debbugs.gnu.org id=B60983.16749312945696 (code B ref 60983); Sat, 28 Jan 2023 18:42:02 +0000 Received: (at 60983) by debbugs.gnu.org; 28 Jan 2023 18:41:34 +0000 Received: from localhost ([127.0.0.1]:41510 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pLq8s-0001To-0j for submit@debbugs.gnu.org; Sat, 28 Jan 2023 13:41:34 -0500 Received: from out0.migadu.com ([94.23.1.103]:65064) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pLq8n-0001Tc-Ui for 60983@debbugs.gnu.org; Sat, 28 Jan 2023 13:41:32 -0500 X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=thornhill.no; s=key1; t=1674931287; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=3SHBY9F66NhB818VUfw7j44SZQdF/zYjDi6yFzzhzA4=; b=AMnSQmYRmyvjr5sHmfAdYnrcvVKeYWLtKGvjCPXhNlBeQEQyYtDP4IuSoueMe0VmMtIZQc s0v4qPXLJfViseYl8yNa1MdSPTE8WzPnziMTr32rJ+TyE0mactKQFN4G8edVVcERykmHsD 1IYzERVXkBMZ5oG4qGXwyX69OiXKCGoCYcqw+Sdr2QOtKaxTbWZ7tnsXwnH7nY3BQFPzRX STEWx2RPXjoI9bJZNMJ4xyAmNFuatXSyqEqdPh6Jrd9zv11xrI1DBVnryv3Uhm2VHrStTC qDT3VYSR639Of84oovrk12t3PkfNhFbZk2FEFD+uJdJxo+PQn/0D5Kbz4KWcqw== From: Theodor Thornhill In-Reply-To: <83k016aizl.fsf@gnu.org> References: <83tu0kkuqo.fsf@gnu.org> <87tu0k3y6t.fsf@thornhill.no> <83edrli46m.fsf@gnu.org> <83357xg3gt.fsf@gnu.org> <871qnessyz.fsf@thornhill.no> <83k016aizl.fsf@gnu.org> Date: Sat, 28 Jan 2023 19:41:26 +0100 Message-ID: <87y1pmqz6x.fsf@thornhill.no> MIME-Version: 1.0 Content-Type: text/plain X-Migadu-Flow: FLOW_OUT X-Spam-Score: -0.7 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) Eli Zaretskii writes: >> From: Theodor Thornhill >> Cc: 60983@debbugs.gnu.org >> Date: Sat, 28 Jan 2023 14:12:52 +0100 >> >> > 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 >> >> >> Are you okay with these patches, Eli? If so, then I can clean them up a >> little and install on emacs-29. In both cases using >> (customize-set-variable 'the-variable val) will take effect in the >> buffer without having to reload anything. > > LGTM, please install, and thanks. > >> Let me know if there are any other changes needed. I'll have some time >> this evening to do some hacking if needed :) > > Will do. Installed. Theo From unknown Sat Aug 16 12:45:36 2025 X-Loop: help-debbugs@gnu.org Subject: bug#60983: 29.0.60; Tree-sitter user-level control Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 29 Jan 2023 13:26:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 60983 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Theodor Thornhill Cc: casouri@gmail.com, 60983@debbugs.gnu.org Received: via spool by 60983-submit@debbugs.gnu.org id=B60983.167499871315140 (code B ref 60983); Sun, 29 Jan 2023 13:26:01 +0000 Received: (at 60983) by debbugs.gnu.org; 29 Jan 2023 13:25:13 +0000 Received: from localhost ([127.0.0.1]:42444 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pM7gH-0003w8-Dk for submit@debbugs.gnu.org; Sun, 29 Jan 2023 08:25:13 -0500 Received: from eggs.gnu.org ([209.51.188.92]:53028) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pM7gF-0003vp-Qs for 60983@debbugs.gnu.org; Sun, 29 Jan 2023 08:25:12 -0500 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 1pM7g9-0001Jg-G2; Sun, 29 Jan 2023 08:25:05 -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=C4+yJWsG3cLn6Sn51p5MhBUS7Lh5NSDUDrfQLY3i5aI=; b=PUEXZeDN1LfP due7JmHwJh11wYMU3LlHfxJ/VAncoBuybIcNfVq4dZoK1ObuEPn3qbXqWf4N2W+1I/H73PE/0gRCD q1NGXq6kof5Rq9z7WlfBgdR724qmo+WtyQFFF3IGcaKFGRJ2jBYHgW1+t2P1Zw9SExOMrCqBCQsS3 MZ1L4ZKYRvlaD92N3Xp7JZLHQJ7R6Nw0Oh0OWEMwF3INM85KPoOBS1x9/+oprySa9T3eOPXLteQDS g6ffr9rT4AGGXnkMziDcQ02m3lNKYSMI81Q670FztG/uctxgwvNKwGdC4gMo3P0CdVKMJkTzWC5mr G+yIaNAG4ha2qEQOrqKlTw==; 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 1pM7g8-0001Fk-LZ; Sun, 29 Jan 2023 08:25:04 -0500 Date: Sun, 29 Jan 2023 15:24:54 +0200 Message-Id: <83zga179sp.fsf@gnu.org> From: Eli Zaretskii In-Reply-To: <87y1pmqz6x.fsf@thornhill.no> (message from Theodor Thornhill on Sat, 28 Jan 2023 19:41:26 +0100) References: <83tu0kkuqo.fsf@gnu.org> <87tu0k3y6t.fsf@thornhill.no> <83edrli46m.fsf@gnu.org> <83357xg3gt.fsf@gnu.org> <871qnessyz.fsf@thornhill.no> <83k016aizl.fsf@gnu.org> <87y1pmqz6x.fsf@thornhill.no> X-Spam-Score: -2.3 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > From: Theodor Thornhill > Cc: casouri@gmail.com, 60983@debbugs.gnu.org > Date: Sat, 28 Jan 2023 19:41:26 +0100 > > >> Let me know if there are any other changes needed. I'll have some time > >> this evening to do some hacking if needed :) > > > > Will do. > > Installed. Thanks, I've now added to the Emacs manual the user-level documentation of tree-sitter features. Please take a look and tell if anything is missing/incorrect. From unknown Sat Aug 16 12:45:36 2025 X-Loop: help-debbugs@gnu.org Subject: bug#60983: 29.0.60; Tree-sitter user-level control Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 29 Jan 2023 13:34:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 60983 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Yuan Fu , Stefan Monnier Cc: 60983@debbugs.gnu.org, theo@thornhill.no Received: via spool by 60983-submit@debbugs.gnu.org id=B60983.167499921916067 (code B ref 60983); Sun, 29 Jan 2023 13:34:02 +0000 Received: (at 60983) by debbugs.gnu.org; 29 Jan 2023 13:33:39 +0000 Received: from localhost ([127.0.0.1]:42450 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pM7oR-0004B4-GC for submit@debbugs.gnu.org; Sun, 29 Jan 2023 08:33:39 -0500 Received: from eggs.gnu.org ([209.51.188.92]:33966) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pM7oO-0004An-Tq for 60983@debbugs.gnu.org; Sun, 29 Jan 2023 08:33:37 -0500 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 1pM7oJ-0002fG-Ja; Sun, 29 Jan 2023 08:33:31 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-version:References:Subject:In-Reply-To:To:From: Date; bh=A4QgDJFmc06kfMqAHaxtiHiNBkwFc0PGlzxGTt+jrDY=; b=fn5TnwA1O0ew5/6Yl6Sb 6KQ6Jwb2aptGb+x2TbNrcem/ydeS75nD641K2aHYvdlBgR5xE/KBPCRb8jYd2E5AgckuILY2bXkIJ T93RY41KDRykD1VGRbUW7K/X7L99P9g5tTj7lp0XIAOUJ7IHPu+ndCSq+Eaesa3X4EAJxXIeXNqcu c8BL5kw2T+bAQzC5BvRAw2N3SjwAs8B1QKAg6Mhoxr1BFax3W6SVVINxL8A3vEGVPzyKGUcHfogW+ qVrsGcgS1OgH10F4LxkJRoLL2LZ3gHC4ZN0G5bwNyCGpVZVKdgCYU+bU+3tFVe0qJc1QNErFCepnK 9U8tId7gA2W/9Q==; 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 1pM7oJ-0000NL-04; Sun, 29 Jan 2023 08:33:31 -0500 Date: Sun, 29 Jan 2023 15:33:22 +0200 Message-Id: <83y1pl79el.fsf@gnu.org> From: Eli Zaretskii In-Reply-To: (message from Yuan Fu on Mon, 23 Jan 2023 15:55:30 -0800) References: <83tu0kkuqo.fsf@gnu.org> <87tu0k3y6t.fsf@thornhill.no> <83mt6ckqts.fsf@gnu.org> <87zgacgiwe.fsf@thornhill.no> <834jshhvjh.fsf@gnu.org> <806A8560-A675-423F-9CFC-67D50D14E304@thornhill.no> MIME-version: 1.0 Content-type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Spam-Score: -2.3 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > From: Yuan Fu > Date: Mon, 23 Jan 2023 15:55:30 -0800 > Cc: Eli Zaretskii , > Bug Report Emacs > > >> Thanks. What about the questions I asked regarding indentation > >> features, and specifically about c-ts-mode-indent-style? > > > > I am working on that, but I hit some issues where I cannot make treesit recognize the new settings before the whole treesit-major-mode-setup reruns. Just setting the symbol doesn't work, and reenabling the mode inside of the :set function isn't the best idea maybe? > > > > I'd love some pointers to how other modes do similar stuff, but I didn't really find anything. > > One common approach is to iterate over all live buffer and reset the variable (in this case treesit-simple-indent-rules) on applicate buffers (in this case c/c++-ts-mode buffers). > > It would be nice to also have a command c-ts-mode-set-style (like c-set-style) that takes a style symbol and sets treesit-simple-indent-rules accordingly. And in major-mode setup, ie, c-ts-mode’s body, you call it with c-ts-mode-indent-style. This command now exists, courtesy of Theo, but I see some strange misbehavior with it in c++-ts-mode, related to keymap inheritance: emacs -Q M-x c-ts-mode RET C-h c C-c C-q => C-c C-q runs the command c-ts-mode-indent-defun But M-x c++-ts-mode RET C-h c C-c C-q => C-c C-q is undefined This is strange, since the binding is defined in c-ts-mode-map, which is used in c-ts-base-mode: (defvar-keymap c-ts-mode-map :doc "Keymap for the C language with tree-sitter" :parent prog-mode-map "C-c C-q" #'c-ts-mode-indent-defun "C-c ." #'c-ts-mode-set-style) ;;;###autoload (define-derived-mode c-ts-base-mode prog-mode "C" "Major mode for editing C, powered by tree-sitter. \\{c-ts-mode-map}" :syntax-table c-ts-mode--syntax-table and both c-ts-mode and c++-ts-mode derive from c-ts-base-mode: (define-derived-mode c-ts-mode c-ts-base-mode "C" "Major mode for editing C, powered by tree-sitter. (define-derived-mode c++-ts-mode c-ts-base-mode "C++" "Major mode for editing C++, powered by tree-sitter. What's missing here? Stefan, any advice? From unknown Sat Aug 16 12:45:36 2025 X-Loop: help-debbugs@gnu.org Subject: bug#60983: 29.0.60; Tree-sitter user-level control Resent-From: Theodor Thornhill Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 29 Jan 2023 19:13:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 60983 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Eli Zaretskii , Yuan Fu , Stefan Monnier Cc: 60983@debbugs.gnu.org Received: via spool by 60983-submit@debbugs.gnu.org id=B60983.167501956630147 (code B ref 60983); Sun, 29 Jan 2023 19:13:02 +0000 Received: (at 60983) by debbugs.gnu.org; 29 Jan 2023 19:12:46 +0000 Received: from localhost ([127.0.0.1]:45409 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pMD6b-0007qA-EZ for submit@debbugs.gnu.org; Sun, 29 Jan 2023 14:12:45 -0500 Received: from out-58.mta0.migadu.com ([91.218.175.58]:11705) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pMD6Z-0007q1-18 for 60983@debbugs.gnu.org; Sun, 29 Jan 2023 14:12:44 -0500 X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=thornhill.no; s=key1; t=1675019561; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=gos7vuyU1vJeqh4HTKOThzmMMmirA6iPI+6jNd6VMLE=; b=vj5jib/9kr2TsNIIVUD9HJcYsldmLAPPj3pjEdkEVgu1jV3OtcJaEY3sEv5bxBhQ6m3nez I5E5x57/nwB8MA/9JblNVxYvXK+p5vsNm1f++sq9LAng67AIvdtzZPCYo85YVpKQmcdRgi LP5gYiC8rBgGbIS4T3EpuiL9FNOH+Ujlukw48ZhUml4oERXpqfi0jl10Q/nyM1Xfu3STAc XbSZMtzhP5zeH7CeCNU7nQp0fRiMsbJcpKZuWNksE2qVpPFJIbHKlW/FLgy0ThhPoSBAk5 CdP2nxGYlHSMomwWM9EAiJ8pyzV/rVFQnPDCYCo9CHT+ZVzoXrh/YJRFVSDWLg== From: Theodor Thornhill In-Reply-To: <83y1pl79el.fsf@gnu.org> References: <83tu0kkuqo.fsf@gnu.org> <87tu0k3y6t.fsf@thornhill.no> <83mt6ckqts.fsf@gnu.org> <87zgacgiwe.fsf@thornhill.no> <834jshhvjh.fsf@gnu.org> <806A8560-A675-423F-9CFC-67D50D14E304@thornhill.no> <83y1pl79el.fsf@gnu.org> Date: Sun, 29 Jan 2023 20:12:39 +0100 Message-ID: <87pmaxqhnc.fsf@thornhill.no> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Migadu-Flow: FLOW_OUT X-Spam-Score: 0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Eli Zaretskii writes: >> From: Yuan Fu >> Date: Mon, 23 Jan 2023 15:55:30 -0800 >> Cc: Eli Zaretskii , >> Bug Report Emacs >>=20 >> >> Thanks. What about the questions I asked regarding indentation >> >> features, and specifically about c-ts-mode-indent-style? >> >=20 >> > I am working on that, but I hit some issues where I cannot make treesi= t recognize the new settings before the whole treesit-major-mode-setup reru= ns. Just setting the symbol doesn't work, and reenabling the mode inside of= the :set function isn't the best idea maybe? >> >=20 >> > I'd love some pointers to how other modes do similar stuff, but I didn= 't really find anything. >>=20 >> One common approach is to iterate over all live buffer and reset the var= iable (in this case treesit-simple-indent-rules) on applicate buffers (in t= his case c/c++-ts-mode buffers). >>=20 >> It would be nice to also have a command c-ts-mode-set-style (like c-set-= style) that takes a style symbol and sets treesit-simple-indent-rules accor= dingly. And in major-mode setup, ie, c-ts-mode=E2=80=99s body, you call it = with c-ts-mode-indent-style. > > This command now exists, courtesy of Theo, but I see some strange > misbehavior with it in c++-ts-mode, related to keymap inheritance: > > emacs -Q > M-x c-ts-mode RET > C-h c C-c C-q > =3D> C-c C-q runs the command c-ts-mode-indent-defun > > But > > M-x c++-ts-mode RET > C-h c C-c C-q > =3D> C-c C-q is undefined > > This is strange, since the binding is defined in c-ts-mode-map, which > is used in c-ts-base-mode: > > (defvar-keymap c-ts-mode-map > :doc "Keymap for the C language with tree-sitter" > :parent prog-mode-map > "C-c C-q" #'c-ts-mode-indent-defun > "C-c ." #'c-ts-mode-set-style) > > ;;;###autoload > (define-derived-mode c-ts-base-mode prog-mode "C" > "Major mode for editing C, powered by tree-sitter. > > \\{c-ts-mode-map}" > :syntax-table c-ts-mode--syntax-table > > and both c-ts-mode and c++-ts-mode derive from c-ts-base-mode: > > (define-derived-mode c-ts-mode c-ts-base-mode "C" > "Major mode for editing C, powered by tree-sitter. > > (define-derived-mode c++-ts-mode c-ts-base-mode "C++" > "Major mode for editing C++, powered by tree-sitter. > > What's missing here? Stefan, any advice? I'm sure you know this, but adding the below patch "fixes" it. It seems like the inheritance isn't registered somehow without a defined mode-map? Theo diff --git a/lisp/progmodes/c-ts-mode.el b/lisp/progmodes/c-ts-mode.el index 612c41bf07..e9f9eea69c 100644 --- a/lisp/progmodes/c-ts-mode.el +++ b/lisp/progmodes/c-ts-mode.el @@ -703,6 +703,10 @@ c-ts-mode-map "C-c C-q" #'c-ts-mode-indent-defun "C-c ." #'c-ts-mode-set-style) =20 +(defvar-keymap c++-ts-mode-map + :doc "Keymap for the C++ language with tree-sitter" + :parent c-ts-mode-map) + ;;;###autoload (define-derived-mode c-ts-base-mode prog-mode "C" "Major mode for editing C, powered by tree-sitter. @@ -810,7 +814,9 @@ c++-ts-mode (add-to-list \\=3D'major-mode-remap-alist \\=3D'(c-or-c++-mode . c-or-c++-ts-mode)) =20 -in your configuration." +in your configuration. + +\\{c++-ts-mode-map}" :group 'c++ =20 (when (treesit-ready-p 'cpp) From unknown Sat Aug 16 12:45:36 2025 X-Loop: help-debbugs@gnu.org Subject: bug#60983: 29.0.60; Tree-sitter user-level control Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 29 Jan 2023 19:42:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 60983 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Theodor Thornhill Cc: casouri@gmail.com, 60983@debbugs.gnu.org, monnier@iro.umontreal.ca Received: via spool by 60983-submit@debbugs.gnu.org id=B60983.1675021321385 (code B ref 60983); Sun, 29 Jan 2023 19:42:02 +0000 Received: (at 60983) by debbugs.gnu.org; 29 Jan 2023 19:42:01 +0000 Received: from localhost ([127.0.0.1]:45431 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pMDYu-000069-W4 for submit@debbugs.gnu.org; Sun, 29 Jan 2023 14:42:01 -0500 Received: from eggs.gnu.org ([209.51.188.92]:59056) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pMDYt-00005u-0a for 60983@debbugs.gnu.org; Sun, 29 Jan 2023 14:42:00 -0500 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 1pMDYn-0000Rj-DC; Sun, 29 Jan 2023 14:41:53 -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=pviwvbTQNjtuUnlI9lW0STz/J+FgJlCnsko6MduUe/E=; b=OwRWPvBhiTl7 BVc2+q1N8+FNFVLviiylbeibAZ5CYJmwEhVoE7LBP0UMn9UwrUOOq281U0zlcjdrInUDW5wucVifM tvGYBwgcVFwvf2RmlMRjkyZl4SF5TfaSMqAMFJLX9Ug2/Lv+QtxZz3pxks6S9v3JZrnX5fFjhhUkV JSCJow0v9nrbSOhr0guRvYCHK26onKQloHJdCkIDsNZNW1nI0kCOUtFbcrwTbH7yRBg3xFtV3wvza zJkBihbVJAUK4lGGJ54S/Cp9gfQHES/T4Q1zS1RNz7ETp7lV1pgcrtaXUgjSBuT1amOEI5h2WXk7e 5FnxzRXIffiQO7qu0ZaBgw==; 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 1pMDYm-0008IU-QM; Sun, 29 Jan 2023 14:41:53 -0500 Date: Sun, 29 Jan 2023 21:41:44 +0200 Message-Id: <83v8kp5ds7.fsf@gnu.org> From: Eli Zaretskii In-Reply-To: <87pmaxqhnc.fsf@thornhill.no> (message from Theodor Thornhill on Sun, 29 Jan 2023 20:12:39 +0100) References: <83tu0kkuqo.fsf@gnu.org> <87tu0k3y6t.fsf@thornhill.no> <83mt6ckqts.fsf@gnu.org> <87zgacgiwe.fsf@thornhill.no> <834jshhvjh.fsf@gnu.org> <806A8560-A675-423F-9CFC-67D50D14E304@thornhill.no> <83y1pl79el.fsf@gnu.org> <87pmaxqhnc.fsf@thornhill.no> X-Spam-Score: -2.3 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > From: Theodor Thornhill > Cc: 60983@debbugs.gnu.org > Date: Sun, 29 Jan 2023 20:12:39 +0100 > > Eli Zaretskii writes: > > > What's missing here? Stefan, any advice? > > > I'm sure you know this, but adding the below patch "fixes" it. It seems > like the inheritance isn't registered somehow without a defined > mode-map? I asked Stefan to help precisely because I don't understand why we need anything beyond what we have already. I thought mode inheritance should have taken care of it, or at least the documentation of define-derived-mode seems to imply that. From unknown Sat Aug 16 12:45:36 2025 X-Loop: help-debbugs@gnu.org Subject: bug#60983: 29.0.60; Tree-sitter user-level control Resent-From: Stefan Monnier Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 30 Jan 2023 02:29:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 60983 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Eli Zaretskii Cc: casouri@gmail.com, 60983@debbugs.gnu.org, Theodor Thornhill Received: via spool by 60983-submit@debbugs.gnu.org id=B60983.16750457307007 (code B ref 60983); Mon, 30 Jan 2023 02:29:01 +0000 Received: (at 60983) by debbugs.gnu.org; 30 Jan 2023 02:28:50 +0000 Received: from localhost ([127.0.0.1]:45692 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pMJub-0001ox-Ox for submit@debbugs.gnu.org; Sun, 29 Jan 2023 21:28:50 -0500 Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:63996) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pMJuZ-0001oj-M9 for 60983@debbugs.gnu.org; Sun, 29 Jan 2023 21:28:48 -0500 Received: from pmg2.iro.umontreal.ca (localhost.localdomain [127.0.0.1]) by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id CEE088089E; Sun, 29 Jan 2023 21:28:41 -0500 (EST) Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id 81A0580899; Sun, 29 Jan 2023 21:28:40 -0500 (EST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1675045720; bh=QIFxnIy5bu/3tchXGZ9zJeUUJP0SUNYiDR0bA5IcPuI=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=noDyqtB5ldT2+laHB3dxB7FPyT0bzwZIvy8+xV9/ydFQW2hj+jVa2YsqGRnotDzC0 ra9x9QyS0tPf3dJWLMsVC57/Wp/xmmbGPw1UwiRo2dPEg0zW/SiFpi6rqh4qlLbVnJ e+E9hI9goYRGNgzj1LOFgR5TIPCV4+Lwisqrf0stwLm7o4S5mlrKEamIGrvVh87spi Et0QKUMzp0GY0hJ7MOOGNXT24270YAmPPJzDRwhv1krPrJZ02D+bGAYadhLHo/yJyN Ip43Pt15Ibp5yEa+dbNKD+ChLVqOvqNYjZEHEh7TFapFZ/viyxQRfiMCfeyo3CgzHT GmNuCrGK0DNIg== Received: from pastel (unknown [167.88.21.243]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 3835A1202C3; Sun, 29 Jan 2023 21:28:40 -0500 (EST) From: Stefan Monnier In-Reply-To: <83v8kp5ds7.fsf@gnu.org> (Eli Zaretskii's message of "Sun, 29 Jan 2023 21:41:44 +0200") Message-ID: References: <83tu0kkuqo.fsf@gnu.org> <87tu0k3y6t.fsf@thornhill.no> <83mt6ckqts.fsf@gnu.org> <87zgacgiwe.fsf@thornhill.no> <834jshhvjh.fsf@gnu.org> <806A8560-A675-423F-9CFC-67D50D14E304@thornhill.no> <83y1pl79el.fsf@gnu.org> <87pmaxqhnc.fsf@thornhill.no> <83v8kp5ds7.fsf@gnu.org> Date: Sun, 29 Jan 2023 21:28:29 -0500 User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain X-SPAM-INFO: Spam detection results: 0 ALL_TRUSTED -1 Passed through trusted hosts only via SMTP BAYES_00 -1.9 Bayes spam probability is 0 to 1% DKIM_SIGNED 0.1 Message has a DKIM or DK signature, not necessarily valid DKIM_VALID -0.1 Message has at least one valid DKIM or DK signature DKIM_VALID_AU -0.1 Message has a valid DKIM or DK signature from author's domain X-SPAM-LEVEL: X-Spam-Score: -2.3 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > I asked Stefan to help precisely because I don't understand why we > need anything beyond what we have already. I thought mode inheritance > should have taken care of it, or at least the documentation of > define-derived-mode seems to imply that. But the `define-derived-mode` uses `prog-mode` as parent, so while the keymap does inherit from its parent mode's keymap, it's just `prog-mode-map` rather than `c-ts-mode-map`. Stefan From unknown Sat Aug 16 12:45:36 2025 X-Loop: help-debbugs@gnu.org Subject: bug#60983: 29.0.60; Tree-sitter user-level control Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 30 Jan 2023 13:46:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 60983 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Stefan Monnier Cc: casouri@gmail.com, 60983@debbugs.gnu.org, theo@thornhill.no Received: via spool by 60983-submit@debbugs.gnu.org id=B60983.16750863345168 (code B ref 60983); Mon, 30 Jan 2023 13:46:02 +0000 Received: (at 60983) by debbugs.gnu.org; 30 Jan 2023 13:45:34 +0000 Received: from localhost ([127.0.0.1]:46717 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pMUTW-0001LI-Fm for submit@debbugs.gnu.org; Mon, 30 Jan 2023 08:45:34 -0500 Received: from eggs.gnu.org ([209.51.188.92]:53480) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pMUTU-0001L3-QI for 60983@debbugs.gnu.org; Mon, 30 Jan 2023 08:45:33 -0500 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 1pMUTP-0002uj-9M; Mon, 30 Jan 2023 08:45:27 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-version:References:Subject:In-Reply-To:To:From: Date; bh=yJyKt9evdViV4PnOiFjEzAX6lhRDLOaRWctTUgnRkM4=; b=r8w//IJja8uuyZYAMju9 E2Dzed0PuCXx2b/D6Ff2ZfYbcvoCo2yfiRlau3ZcIBa/8Nnk9dkfNVSyPWTybaJuFzuadPAfxLjuX J/0jOkz980bT4txkyvb1rbjb3zbDUPt+v84IRbfApku0vIOOEwjBfz6xtvCq5Q7Fb6rPRmFHEY7VW Thqi85Wh4TuPwfTskXxU7Ryb+SdfI78lRRv2SmgR56H4uRESKFVYmibAMzA5Z3jEBoIs1bKz5BE+A 0u6vFP+hWIImpbmCTfdYYQk8Qb4lVwjYpMypxIS+l4NHcEswJakEZLlIBC3lWLV9k5pfty9v3fSD/ cvIUVC/IMOuNEw==; 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 1pMUTN-0006VW-SU; Mon, 30 Jan 2023 08:45:27 -0500 Date: Mon, 30 Jan 2023 15:45:18 +0200 Message-Id: <831qnc5e6p.fsf@gnu.org> From: Eli Zaretskii In-Reply-To: (message from Stefan Monnier on Sun, 29 Jan 2023 21:28:29 -0500) References: <83tu0kkuqo.fsf@gnu.org> <87tu0k3y6t.fsf@thornhill.no> <83mt6ckqts.fsf@gnu.org> <87zgacgiwe.fsf@thornhill.no> <834jshhvjh.fsf@gnu.org> <806A8560-A675-423F-9CFC-67D50D14E304@thornhill.no> <83y1pl79el.fsf@gnu.org> <87pmaxqhnc.fsf@thornhill.no> <83v8kp5ds7.fsf@gnu.org> MIME-version: 1.0 Content-type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Spam-Score: -2.3 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > From: Stefan Monnier > Cc: Theodor Thornhill , casouri@gmail.com, > 60983@debbugs.gnu.org > Date: Sun, 29 Jan 2023 21:28:29 -0500 > > > I asked Stefan to help precisely because I don't understand why we > > need anything beyond what we have already. I thought mode inheritance > > should have taken care of it, or at least the documentation of > > define-derived-mode seems to imply that. > > But the `define-derived-mode` uses `prog-mode` as parent, so while the > keymap does inherit from its parent mode's keymap, it's just > `prog-mode-map` rather than `c-ts-mode-map`. Ah, so it's this bit of define-derived-mode's documentation: • The new mode has its own sparse keymap, named ‘VARIANT-map’. ‘define-derived-mode’ makes the parent mode’s keymap the parent of the new map, unless ‘VARIANT-map’ is already set and already has a parent. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^ IOW, the problem is that c-ts-base-mode defined c-ts-mode-map as its keymap, so when c-ts-mode is defined, its keymap variable "is already set and already has a parent". Thanks, this is now fixed. From unknown Sat Aug 16 12:45:36 2025 X-Loop: help-debbugs@gnu.org Subject: bug#60983: 29.0.60; Tree-sitter user-level control Resent-From: Yuan Fu Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 03 Feb 2023 03:08:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 60983 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Eli Zaretskii Cc: 60983@debbugs.gnu.org, theo@thornhill.no X-Debbugs-Original-Cc: Bug Report Emacs , Theodor Thornhill Received: via spool by submit@debbugs.gnu.org id=B.167539364625996 (code B ref -1); Fri, 03 Feb 2023 03:08:02 +0000 Received: (at submit) by debbugs.gnu.org; 3 Feb 2023 03:07:26 +0000 Received: from localhost ([127.0.0.1]:36235 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pNmQ9-0006lE-V4 for submit@debbugs.gnu.org; Thu, 02 Feb 2023 22:07:26 -0500 Received: from lists.gnu.org ([209.51.188.17]:41532) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pNmQ7-0006l3-Jz for submit@debbugs.gnu.org; Thu, 02 Feb 2023 22:07:23 -0500 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 1pNmQ7-0002zS-EM for bug-gnu-emacs@gnu.org; Thu, 02 Feb 2023 22:07:23 -0500 Received: from mail-pj1-x1034.google.com ([2607:f8b0:4864:20::1034]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pNmQ5-0006Ez-RH; Thu, 02 Feb 2023 22:07:23 -0500 Received: by mail-pj1-x1034.google.com with SMTP id f16-20020a17090a9b1000b0023058bbd7b2so3114197pjp.0; Thu, 02 Feb 2023 19:07:21 -0800 (PST) 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=hNu7flm7jg+Vn69bD8iengLlvT3WM6XE0pI/idwKnFE=; b=oUDH3LO03WJ+HlkLYRhUscXe2MoF3fr+x3WA+Oq45/eVrNHYq4CH/rcdGsp9MYbFbe TOBwBLu47v6hI1WLtUJ+Ydj7YKm/E2dAV9lKPXs+TZwVkUqJ7sAMvNFRdxmtGia7VcNu xwfN7DLpGjM29SLlQMsnfuTWWq8uLYdWy/HwB9EXLeomEciOWjEkxgz9jquswK3FOTKo kM8AsI3z7eorGCrCaIfqi7K9YlDQ9rMjk6RqN94j3bDfssLsxJYbhaDEq2Dp/MQKqLeA L91MKdCNm4EnEUMfvAt/j6S92Jx54z/p55DmbxI//Cbwx13nxpLWJDqrQb3y+QsmqgLV YPQg== 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=hNu7flm7jg+Vn69bD8iengLlvT3WM6XE0pI/idwKnFE=; b=BhZK/bwkD6qCkNI6NKHpukvNcqjCAs/YLosZRVSMSwj9gEK+pWpaVatPo8IPfgyv9J Gz6/IOeQE8VKv2HFU1R5ZXQtHMJQ0w/gcxYGZjtMvN5D0puYbyGutQULquUlpu+wan6c fPDE+jU6hYYXWvUMfqKdP/bA6H5oErhWBHRVStUB8cjb7oNjORjAiGecrvguu3wm0Zna 0WGAVi0VjYkFtpLziy15rLawXoOdpyimQBPYX2JRwnChgp5WMhinu0hm1fVGlqJ+gfUB BdoWQj0vAf7IuOrjLiWQyJ/d9lv2bcXi9Po1xpoXqL/l+ESUyjCMbWU3V19rVYuvWj96 ugqA== X-Gm-Message-State: AO0yUKVM2F4A00Ef1VqtF60rB/K8MnNs7TZ7At7yt5Jl24qTWpbOfM6m jj+PWlFAnrKQ/1bSr1ZOVcR3PaNPc1c= X-Google-Smtp-Source: AK7set8UAwqjvqxHHHc1ZZVwHhaQRCRJSzTCMK8Ra/zP5zQzzAg155AqI70F1nDFezqIc44OFb6XhQ== X-Received: by 2002:a17:902:ec89:b0:194:5c63:364c with SMTP id x9-20020a170902ec8900b001945c63364cmr11686378plg.62.1675393639723; Thu, 02 Feb 2023 19:07:19 -0800 (PST) Received: from smtpclient.apple (cpe-172-117-161-177.socal.res.rr.com. [172.117.161.177]) by smtp.gmail.com with ESMTPSA id g13-20020a170902c38d00b00189e7cb8b89sm397203plg.127.2023.02.02.19.07.19 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 02 Feb 2023 19:07:19 -0800 (PST) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3731.300.101.1.3\)) From: Yuan Fu In-Reply-To: <83tu0kkuqo.fsf@gnu.org> Date: Thu, 2 Feb 2023 19:07:07 -0800 Content-Transfer-Encoding: quoted-printable Message-Id: <7B62BDA1-C46B-4373-B3A7-2F9E34F3D803@gmail.com> References: <83tu0kkuqo.fsf@gnu.org> X-Mailer: Apple Mail (2.3731.300.101.1.3) Received-SPF: pass client-ip=2607:f8b0:4864:20::1034; envelope-from=casouri@gmail.com; helo=mail-pj1-x1034.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-Spam-Score: -1.3 (-) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.3 (--) I just read the new manual sections, thanks for the work! Do we want to = mention treesit-font-lock-recompute-features in the user manual? = That=E2=80=99s the only way for someone to add/remove specific features = (as opposed to changing the decoration level). (We might also want to = mention that changing treesit-font-lock-features directly doesn=E2=80=99t = have any effect, similar to treesit-font-lock-level.) treesit-font-lock-recompute-features is intended to be used in major = mode hooks, like (add-hook 'c-ts-mode-hook #'c-ts-setup) (defun c-ts-mode-setup () (treesit-font-lock-recompute-features '(emacs-devel) '(property bracket delimiter operator variable function))) Yuan= From unknown Sat Aug 16 12:45:36 2025 X-Loop: help-debbugs@gnu.org Subject: bug#60983: 29.0.60; Tree-sitter user-level control Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 03 Feb 2023 07:48:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 60983 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Yuan Fu Cc: 60983@debbugs.gnu.org, theo@thornhill.no X-Debbugs-Original-Cc: bug-gnu-emacs@gnu.org, theo@thornhill.no Received: via spool by submit@debbugs.gnu.org id=B.167541045924759 (code B ref -1); Fri, 03 Feb 2023 07:48:01 +0000 Received: (at submit) by debbugs.gnu.org; 3 Feb 2023 07:47:39 +0000 Received: from localhost ([127.0.0.1]:36423 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pNqnL-0006RE-AN for submit@debbugs.gnu.org; Fri, 03 Feb 2023 02:47:39 -0500 Received: from lists.gnu.org ([209.51.188.17]:37336) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pNqnJ-0006Qr-3V for submit@debbugs.gnu.org; Fri, 03 Feb 2023 02:47:37 -0500 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 1pNqnG-0003q2-8a for bug-gnu-emacs@gnu.org; Fri, 03 Feb 2023 02:47:34 -0500 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 1pNqnD-0005T8-Uv; Fri, 03 Feb 2023 02:47:33 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-version:References:Subject:In-Reply-To:To:From: Date; bh=9IffI0usOFfFW5f5a4MP44eE4/R7KF72+M2gDWB6+Vo=; b=LXjhUmtet9pMA38wyF/2 sdVBE6bYxF1KP6Bl87fA6bJ2W/Gklt27HaB+3bUGoy45w9h0gm3gcbPb4HGU+iKwmiaPPytEQJ8GK L/naW5ZwCp/gEiB+awgx7B1SXgdOHQWWABCRoNuJFl3qxB+t13ggiRGuqn1npmsI3NBS8zLI+9wCf oVn1pFXQH3zlIgoMVyuRUnqs1Rmfqf71nx7m7+s3/Yj9TBKnrT9HujxqwtwPxviZx8/DfP92oWnwV M4Bjm/7HVt48LZpDt4MiVmwd8DksPSChkDQrnc9OV0cONiusALjJTY4fUyAeAtVLIriPH4KPzgkFE pgLfChGw+CPuSw==; 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 1pNqnC-0002LB-WE; Fri, 03 Feb 2023 02:47:31 -0500 Date: Fri, 03 Feb 2023 09:47:34 +0200 Message-Id: <83tu03ur55.fsf@gnu.org> From: Eli Zaretskii In-Reply-To: <7B62BDA1-C46B-4373-B3A7-2F9E34F3D803@gmail.com> (message from Yuan Fu on Thu, 2 Feb 2023 19:07:07 -0800) References: <83tu0kkuqo.fsf@gnu.org> <7B62BDA1-C46B-4373-B3A7-2F9E34F3D803@gmail.com> MIME-version: 1.0 Content-type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Spam-Score: -2.3 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > From: Yuan Fu > Date: Thu, 2 Feb 2023 19:07:07 -0800 > Cc: Bug Report Emacs , > Theodor Thornhill > > I just read the new manual sections, thanks for the work! Do we want to mention treesit-font-lock-recompute-features in the user manual? That’s the only way for someone to add/remove specific features (as opposed to changing the decoration level). (We might also want to mention that changing treesit-font-lock-features directly doesn’t have any effect, similar to treesit-font-lock-level.) treesit-font-lock-recompute-features is a non-interactive function, so mentioning it in the user manual is generally inappropriate. Users are unlikely to add features that aren't already defined in the mode's font-lock setup. This function and its use in these situations are described in the ELisp manual, where I think it belongs. As for the fact that changing treesit-font-lock-feature-list directly doesn't have any effect, that is already in the doc string. I'm not opposed to mentioning that in the manual as well, but I see no problem with what we have. > treesit-font-lock-recompute-features is intended to be used in major mode hooks, like > > (add-hook 'c-ts-mode-hook #'c-ts-setup) > > (defun c-ts-mode-setup () > (treesit-font-lock-recompute-features > '(emacs-devel) > '(property bracket delimiter operator variable function))) This belongs to the ELisp manual, IMO. From unknown Sat Aug 16 12:45:36 2025 X-Loop: help-debbugs@gnu.org Subject: bug#60983: 29.0.60; Tree-sitter user-level control Resent-From: Yuan Fu Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 04 Feb 2023 23:39:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 60983 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Eli Zaretskii Cc: 60983@debbugs.gnu.org, theo@thornhill.no X-Debbugs-Original-Cc: Bug Report Emacs , theo@thornhill.no Received: via spool by submit@debbugs.gnu.org id=B.16755539175809 (code B ref -1); Sat, 04 Feb 2023 23:39:01 +0000 Received: (at submit) by debbugs.gnu.org; 4 Feb 2023 23:38:37 +0000 Received: from localhost ([127.0.0.1]:43610 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pOS7B-0001Vc-DF for submit@debbugs.gnu.org; Sat, 04 Feb 2023 18:38:37 -0500 Received: from lists.gnu.org ([209.51.188.17]:47926) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pOS77-0001VO-AO for submit@debbugs.gnu.org; Sat, 04 Feb 2023 18:38:35 -0500 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 1pOS77-0007pe-47 for bug-gnu-emacs@gnu.org; Sat, 04 Feb 2023 18:38:33 -0500 Received: from mail-pl1-x62b.google.com ([2607:f8b0:4864:20::62b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pOS75-0002Dy-Ji; Sat, 04 Feb 2023 18:38:32 -0500 Received: by mail-pl1-x62b.google.com with SMTP id z1so8757030plg.6; Sat, 04 Feb 2023 15:38:30 -0800 (PST) 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=XhnX5+0lAAOU7QtJ+oXlFdrz5vl8c4dgaZJ8Xi4svzY=; b=W2k9IbDXcxNpbPFhHcFuWTo1dK6Zs5ZauwBf8kDL/lFOJ7tJiBT3n+II617Yw7TaHf N9b86YYVSR/0yorQYskh4CnikFa3dRNO5rEYVhxPuRstLTJb4ajIp4uanH6E++mFp0V2 HPoOvBkAK+Xajc6Wm5B+a3sAyXMAKm84ij5rIqzhwA9W9RR812ECmB6qySzUTC87hyzu ScAmcrL4JZRXnLPcT/tYO+SmT+6WWuiYxYG8onGbnLRAuFhFl0PayhhWa9ixfaZbuv6g 4ajYo92tPmiySgN+DFbW+aFZ6YAy/+XOJ+mG6wnDieO82LlIXxhnvNXnvzzonaa4rp/4 B/TA== 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=XhnX5+0lAAOU7QtJ+oXlFdrz5vl8c4dgaZJ8Xi4svzY=; b=h1H2rFBWP0Epb7gkIa4l7jdTOsjJ/u3lJ6rvupL7xOmpKp3suA+twh5LYJiGjqusll 0zbQNWGWUf0FGwttZPr9rVbVOpN3iaVvki3TQXJrJL3buZOLXCesRRJ3zXmUQJ8FeP6K 7upqrRDzdccSao6BPwdxVh1g8AAiYdAJedmnNm6es0/PrNE7z+TnxWhjeuSgc9qbBIF/ VY1oLFJhIa3uS6kkMOloduOyIKzbCzHR0772rg6uPEzAz+26pf1X3fradmCYk/wcPWjI aLRhOdrWZzIJ6S7cOlyKVsZRovj95RwhJ0aVpAGeQClO2GJwwIugbrTlSxGi/UkAleUf nAXA== X-Gm-Message-State: AO0yUKVuyqdXFVNTgv4x7svMisbMkXCXRwg6E59c4gQVyAvmwaC3zQLy z9/824u2mBhqq4eNR3UsV13LgaK9GZg= X-Google-Smtp-Source: AK7set/r3VweWUODbSHVkmaMEc8P6H29iQqZq6gHDAEWvge8zuJug3PQQWgJ3XA6rzBDVAZ5KCEHAg== X-Received: by 2002:a17:90b:4a90:b0:230:8afb:7a55 with SMTP id lp16-20020a17090b4a9000b002308afb7a55mr4111338pjb.0.1675553909889; Sat, 04 Feb 2023 15:38:29 -0800 (PST) Received: from smtpclient.apple (cpe-172-117-161-177.socal.res.rr.com. [172.117.161.177]) by smtp.gmail.com with ESMTPSA id g8-20020a17090a290800b00230aa9a61a2sm68996pjd.7.2023.02.04.15.38.29 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sat, 04 Feb 2023 15:38:29 -0800 (PST) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3731.300.101.1.3\)) From: Yuan Fu In-Reply-To: <83tu03ur55.fsf@gnu.org> Date: Sat, 4 Feb 2023 15:38:17 -0800 Content-Transfer-Encoding: quoted-printable Message-Id: References: <83tu0kkuqo.fsf@gnu.org> <7B62BDA1-C46B-4373-B3A7-2F9E34F3D803@gmail.com> <83tu03ur55.fsf@gnu.org> X-Mailer: Apple Mail (2.3731.300.101.1.3) Received-SPF: pass client-ip=2607:f8b0:4864:20::62b; envelope-from=casouri@gmail.com; helo=mail-pl1-x62b.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-Spam-Score: -1.3 (-) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.3 (--) > On Feb 2, 2023, at 11:47 PM, Eli Zaretskii wrote: >=20 >> From: Yuan Fu >> Date: Thu, 2 Feb 2023 19:07:07 -0800 >> Cc: Bug Report Emacs , >> Theodor Thornhill >>=20 >> I just read the new manual sections, thanks for the work! Do we want = to mention treesit-font-lock-recompute-features in the user manual? = That=E2=80=99s the only way for someone to add/remove specific features = (as opposed to changing the decoration level). (We might also want to = mention that changing treesit-font-lock-features directly doesn=E2=80=99t = have any effect, similar to treesit-font-lock-level.) >=20 > treesit-font-lock-recompute-features is a non-interactive function, so > mentioning it in the user manual is generally inappropriate. Users > are unlikely to add features that aren't already defined in the mode's > font-lock setup. >=20 > This function and its use in these situations are described in the > ELisp manual, where I think it belongs. >=20 > As for the fact that changing treesit-font-lock-feature-list directly > doesn't have any effect, that is already in the doc string. I'm not > opposed to mentioning that in the manual as well, but I see no problem > with what we have. I see. Sounds good to me. I meant enabling/disabling features when I say = =E2=80=9Cadding/removing=E2=80=9D features. Does that make anything = different? >=20 >> treesit-font-lock-recompute-features is intended to be used in major = mode hooks, like >>=20 >> (add-hook 'c-ts-mode-hook #'c-ts-setup) >>=20 >> (defun c-ts-mode-setup () >> (treesit-font-lock-recompute-features >> '(emacs-devel) >> '(property bracket delimiter operator variable function))) >=20 > This belongs to the ELisp manual, IMO. Ok, then I think there=E2=80=99s nothing needed to change in the Emacs = manual. Yuan= From unknown Sat Aug 16 12:45:36 2025 X-Loop: help-debbugs@gnu.org Subject: bug#60983: 29.0.60; Tree-sitter user-level control Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 05 Feb 2023 06:02:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 60983 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Yuan Fu Cc: 60983@debbugs.gnu.org, theo@thornhill.no X-Debbugs-Original-Cc: bug-gnu-emacs@gnu.org, theo@thornhill.no Received: via spool by submit@debbugs.gnu.org id=B.167557687410962 (code B ref -1); Sun, 05 Feb 2023 06:02:02 +0000 Received: (at submit) by debbugs.gnu.org; 5 Feb 2023 06:01:14 +0000 Received: from localhost ([127.0.0.1]:43822 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pOY5S-0002qk-5v for submit@debbugs.gnu.org; Sun, 05 Feb 2023 01:01:14 -0500 Received: from lists.gnu.org ([209.51.188.17]:39346) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pOY5P-0002qX-8T for submit@debbugs.gnu.org; Sun, 05 Feb 2023 01:01:13 -0500 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 1pOY5L-0002Pf-TO for bug-gnu-emacs@gnu.org; Sun, 05 Feb 2023 01:01:08 -0500 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 1pOY5K-0001NO-DJ; Sun, 05 Feb 2023 01:01:07 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-version:References:Subject:In-Reply-To:To:From: Date; bh=5ajwOKm2xqLzn8lBcgnHMgeeY39uzrJryDgHqhnQIqs=; b=jBmAwqoz63JOO5nddTkg fHVOZq+VxIeMkBN4zBRnpZqYMmkqSZHOLUE0QMCEvZ5dhwKbEFeYG28d/wwm9peJV9B1mAtWABWHN Sq6NHlGKOn8dtdmFqNSDUCj+I+pNCCxoKF1XiK/NPV0CC1QKxehRJNK9g2TM5MgCWUFGED9NFx53V nZeezDHD+3SjXNJdFW2xIt2eRDngR7OdDujDwLVElIB6xYrlKNR7xNxWzYc5hixedMWH5tqlBsjI+ GTj3XiuRzj/w1kALnqIcmQtzXLcYgO+7KYQEoBx7bgzssRVCJGwjWu9ht7jbqtc/+Aqcdudg/+frL FBEnydy3wjzvJQ==; 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 1pOY5I-0006UN-T6; Sun, 05 Feb 2023 01:01:05 -0500 Date: Sun, 05 Feb 2023 08:01:14 +0200 Message-Id: <83zg9sslat.fsf@gnu.org> From: Eli Zaretskii In-Reply-To: (message from Yuan Fu on Sat, 4 Feb 2023 15:38:17 -0800) References: <83tu0kkuqo.fsf@gnu.org> <7B62BDA1-C46B-4373-B3A7-2F9E34F3D803@gmail.com> <83tu03ur55.fsf@gnu.org> MIME-version: 1.0 Content-type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Spam-Score: -2.3 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > From: Yuan Fu > Date: Sat, 4 Feb 2023 15:38:17 -0800 > Cc: Bug Report Emacs , > theo@thornhill.no > > > treesit-font-lock-recompute-features is a non-interactive function, so > > mentioning it in the user manual is generally inappropriate. Users > > are unlikely to add features that aren't already defined in the mode's > > font-lock setup. > > > > This function and its use in these situations are described in the > > ELisp manual, where I think it belongs. > > > > As for the fact that changing treesit-font-lock-feature-list directly > > doesn't have any effect, that is already in the doc string. I'm not > > opposed to mentioning that in the manual as well, but I see no problem > > with what we have. > > I see. Sounds good to me. I meant enabling/disabling features when I say “adding/removing” features. Does that make anything different? Yes, that's how I understood what you were saying: changing the list of features enabled/disabled by specific levels. This is not a user-level thing, so describing it in the ELisp manual is good enough, I think. (If it turns out users want to do this kind of thing too often, it probably means our design of the user-facing features is sub-optimal and should be improved.) From unknown Sat Aug 16 12:45:36 2025 X-Loop: help-debbugs@gnu.org Subject: bug#60983: 29.0.60; Tree-sitter user-level control Resent-From: Yuan Fu Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 05 Feb 2023 07:56:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 60983 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Eli Zaretskii Cc: 60983@debbugs.gnu.org, theo@thornhill.no X-Debbugs-Original-Cc: Bug Report Emacs , theo@thornhill.no Received: via spool by submit@debbugs.gnu.org id=B.16755837161098 (code B ref -1); Sun, 05 Feb 2023 07:56:01 +0000 Received: (at submit) by debbugs.gnu.org; 5 Feb 2023 07:55:16 +0000 Received: from localhost ([127.0.0.1]:44020 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pOZrn-0000Hb-Gt for submit@debbugs.gnu.org; Sun, 05 Feb 2023 02:55:16 -0500 Received: from lists.gnu.org ([209.51.188.17]:54608) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pOZrk-0000HR-9E for submit@debbugs.gnu.org; Sun, 05 Feb 2023 02:55:14 -0500 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 1pOZrk-0008Ao-1r for bug-gnu-emacs@gnu.org; Sun, 05 Feb 2023 02:55:12 -0500 Received: from mail-pl1-x632.google.com ([2607:f8b0:4864:20::632]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pOZri-0001xj-G5; Sun, 05 Feb 2023 02:55:11 -0500 Received: by mail-pl1-x632.google.com with SMTP id h15so1885973plk.12; Sat, 04 Feb 2023 23:55:09 -0800 (PST) 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=4wCv6z+OYu09K5Pfmwx8Z4tlSzMHrc2KNbHsOBlaJ1I=; b=XdcLnCdP/0e1gej8mbtLbm8rNdFXSquHC1rk4GuwnYoSNsIq6s4CEbc6OXGK2XXxea yloNHC8qI3OJfRS6XzlONuq8AIlRS4npLMaz879P1IjLKXycBaN0NHsEMCuSkyRaB/rm /4KZfBD52mf8dWhNf1eE7fWMXos0M93CzCXPrlX79iGEeByFg18iwFdD0K/VvfVEmXgb XiR1nCbezYOt99ctiiNBrTWYR9flYSRX10ns5wULAO6G+i/5PEEM6zooMynNJj8111pe RPMa9K2ThSmi9i4UMivSw4rt80Okxl25N+lY6FrV0kkNhfmEjjUYqbtEFGchrQc0OKKg Q0pQ== 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=4wCv6z+OYu09K5Pfmwx8Z4tlSzMHrc2KNbHsOBlaJ1I=; b=jHzfDh/0ehGh9vngWVk+jZXYVND4tEU0zBAqtw3DEII9OkjQ0OYx/op5rZNHz9g30A WJMzHjXxPCcX6NSu0ngILVpVRDP19QJjOG9gh/d/U4C0GVVADia2Nmm1ceif38lGi0vY kCI7CcNKiykNXIII2Gu+dsWVawK87oBfQZamcXMNofp+mF0h9V1kjZboX/Jr/91pJU3l HSwxTEHvc7jiPHnfUqMMUpgchLWl63I0EhiscG7Wl4ataS6ALdAkFJuj6CXDWnSELg1d IPEuz7Z1QGz4yqPv8+deo/J4xLolFWzlBXgGzPAtl8vbmslgagtHKP/E84qNVmljicNu rcQQ== X-Gm-Message-State: AO0yUKXPU11i0P1nkO6QeCvKSRTA6qLqUm7xvszl+CZwVHgMAdW3K9Dp judV5cHut5ec7xbjhlnoKuNKndzzxZc= X-Google-Smtp-Source: AK7set+ay/MuviFP7H4vcWIks0F8BE80LJg5ruquHlS/7Pkdt6HWyrqBRSuI7+DcY5ul3G+knijyQQ== X-Received: by 2002:a17:902:cec8:b0:196:88e0:ea10 with SMTP id d8-20020a170902cec800b0019688e0ea10mr18012074plg.60.1675583708284; Sat, 04 Feb 2023 23:55:08 -0800 (PST) Received: from smtpclient.apple (cpe-172-117-161-177.socal.res.rr.com. [172.117.161.177]) by smtp.gmail.com with ESMTPSA id a2-20020a170902ee8200b00186f0f59c85sm4458586pld.235.2023.02.04.23.55.07 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sat, 04 Feb 2023 23:55:07 -0800 (PST) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3731.300.101.1.3\)) From: Yuan Fu In-Reply-To: <83zg9sslat.fsf@gnu.org> Date: Sat, 4 Feb 2023 23:54:56 -0800 Content-Transfer-Encoding: quoted-printable Message-Id: <1CC382C7-8663-4F12-9163-916EE1FFCFBB@gmail.com> References: <83tu0kkuqo.fsf@gnu.org> <7B62BDA1-C46B-4373-B3A7-2F9E34F3D803@gmail.com> <83tu03ur55.fsf@gnu.org> <83zg9sslat.fsf@gnu.org> X-Mailer: Apple Mail (2.3731.300.101.1.3) Received-SPF: pass client-ip=2607:f8b0:4864:20::632; envelope-from=casouri@gmail.com; helo=mail-pl1-x632.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-Spam-Score: -1.3 (-) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.3 (--) > On Feb 4, 2023, at 10:01 PM, Eli Zaretskii wrote: >=20 >> From: Yuan Fu >> Date: Sat, 4 Feb 2023 15:38:17 -0800 >> Cc: Bug Report Emacs , >> theo@thornhill.no >>=20 >>> treesit-font-lock-recompute-features is a non-interactive function, = so >>> mentioning it in the user manual is generally inappropriate. Users >>> are unlikely to add features that aren't already defined in the = mode's >>> font-lock setup. >>>=20 >>> This function and its use in these situations are described in the >>> ELisp manual, where I think it belongs. >>>=20 >>> As for the fact that changing treesit-font-lock-feature-list = directly >>> doesn't have any effect, that is already in the doc string. I'm not >>> opposed to mentioning that in the manual as well, but I see no = problem >>> with what we have. >>=20 >> I see. Sounds good to me. I meant enabling/disabling features when I = say =E2=80=9Cadding/removing=E2=80=9D features. Does that make anything = different? >=20 > Yes, that's how I understood what you were saying: changing the list > of features enabled/disabled by specific levels. This is not a > user-level thing, so describing it in the ELisp manual is good enough, > I think. (If it turns out users want to do this kind of thing too > often, it probably means our design of the user-facing features is > sub-optimal and should be improved.) I see, my description and the documentation is still not clear enough, = I=E2=80=99m afraid. treesit-font-lock-recompute-feature does not = add/remove features that belongs to a level. The design is that, the = user uses decoration level to set the rough level, which enables a set = of features, then use treesit-font-lock-recompute-feature to do more = fine-grained control by additionally enabling/disabling features.=20 For example in c-ts-mode, if I set the decoration level to 2, I=E2=80=99d = have these features: comment, definition, keyword, preprocessor, string, = type. If I also want the assignment features, which is in level 3, but = don=E2=80=99t want other features in level 3, I would use = treesit-font-lock-recompute-feature to enable that feature. Similarly, I = can use treesit-font-lock-recompute-feature to disable the preprocessor = which is at level 2, without affecting other features status. Yuan From unknown Sat Aug 16 12:45:36 2025 X-Loop: help-debbugs@gnu.org Subject: bug#60983: 29.0.60; Tree-sitter user-level control Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 05 Feb 2023 09:24:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 60983 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Yuan Fu Cc: 60983@debbugs.gnu.org, theo@thornhill.no X-Debbugs-Original-Cc: bug-gnu-emacs@gnu.org, theo@thornhill.no Received: via spool by submit@debbugs.gnu.org id=B.16755890119998 (code B ref -1); Sun, 05 Feb 2023 09:24:01 +0000 Received: (at submit) by debbugs.gnu.org; 5 Feb 2023 09:23:31 +0000 Received: from localhost ([127.0.0.1]:44074 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pObFD-0002bB-9H for submit@debbugs.gnu.org; Sun, 05 Feb 2023 04:23:31 -0500 Received: from lists.gnu.org ([209.51.188.17]:51610) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pObF8-0002b0-PA for submit@debbugs.gnu.org; Sun, 05 Feb 2023 04:23:29 -0500 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 1pObF4-0007QE-P4 for bug-gnu-emacs@gnu.org; Sun, 05 Feb 2023 04:23:25 -0500 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 1pObF4-0006Jq-Bw; Sun, 05 Feb 2023 04:23:22 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-version:References:Subject:In-Reply-To:To:From: Date; bh=4LeKSI6TNqEcbgoKkG+/i9QxHN+dZCON6VZMNXlQ5nU=; b=oirJziLRXTPsrfjGBYUS Ui+tP5y5XjRqH8sPnQ8zGb8+GHKoBuqtEWkpO6wINZMOBpAT69Iteo3fZ7TYNKLu2powCe6Wa6qY+ 2MuvoBNgDXibhIGqbaM/J1A2pa8Wxjv0fskGxRcrvW/tv130rB1o4VI7Q7Z2dxXntWMNSvr3XNqb+ d1MoxNvWZ9bcDTn4vn3ENZ5HkTUm5P1ocIHsnR/9lb3zQS42WLWnVp1jWV5NZbTlB5xxTY0jrp+FV b7Rf4Dm5shKQn1KJtwoj6Ym8C3/31aOU6JN8Jm5wg4wDRUJFIHRH3oCXuHXzfFaFpfv0QSzzILP9X 92YiLrC+tP5DDA==; 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 1pObF3-0006K6-5r; Sun, 05 Feb 2023 04:23:21 -0500 Date: Sun, 05 Feb 2023 11:23:31 +0200 Message-Id: <83ilggsbxo.fsf@gnu.org> From: Eli Zaretskii In-Reply-To: <1CC382C7-8663-4F12-9163-916EE1FFCFBB@gmail.com> (message from Yuan Fu on Sat, 4 Feb 2023 23:54:56 -0800) References: <83tu0kkuqo.fsf@gnu.org> <7B62BDA1-C46B-4373-B3A7-2F9E34F3D803@gmail.com> <83tu03ur55.fsf@gnu.org> <83zg9sslat.fsf@gnu.org> <1CC382C7-8663-4F12-9163-916EE1FFCFBB@gmail.com> MIME-version: 1.0 Content-type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Spam-Score: -2.3 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > From: Yuan Fu > Date: Sat, 4 Feb 2023 23:54:56 -0800 > Cc: Bug Report Emacs , > theo@thornhill.no > > > Yes, that's how I understood what you were saying: changing the list > > of features enabled/disabled by specific levels. This is not a > > user-level thing, so describing it in the ELisp manual is good enough, > > I think. (If it turns out users want to do this kind of thing too > > often, it probably means our design of the user-facing features is > > sub-optimal and should be improved.) > > I see, my description and the documentation is still not clear enough, I’m afraid. treesit-font-lock-recompute-feature does not add/remove features that belongs to a level. The design is that, the user uses decoration level to set the rough level, which enables a set of features, then use treesit-font-lock-recompute-feature to do more fine-grained control by additionally enabling/disabling features. > > For example in c-ts-mode, if I set the decoration level to 2, I’d have these features: comment, definition, keyword, preprocessor, string, type. If I also want the assignment features, which is in level 3, but don’t want other features in level 3, I would use treesit-font-lock-recompute-feature to enable that feature. Similarly, I can use treesit-font-lock-recompute-feature to disable the preprocessor which is at level 2, without affecting other features status. That's exactly what I understood, and that was what I responded to. I don't think it's a user-level feature to tweak the list of features that are enabled/disables by a certain decoration level. It is on the level of Lisp programming, and therefore should be described in the ELisp manual. From unknown Sat Aug 16 12:45:36 2025 X-Loop: help-debbugs@gnu.org Subject: bug#60983: 29.0.60; Tree-sitter user-level control Resent-From: Yuan Fu Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 05 Feb 2023 09:44:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 60983 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Eli Zaretskii Cc: 60983@debbugs.gnu.org, theo@thornhill.no X-Debbugs-Original-Cc: Bug Report Emacs , theo@thornhill.no Received: via spool by submit@debbugs.gnu.org id=B.167559019611920 (code B ref -1); Sun, 05 Feb 2023 09:44:02 +0000 Received: (at submit) by debbugs.gnu.org; 5 Feb 2023 09:43:16 +0000 Received: from localhost ([127.0.0.1]:44096 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pObYK-00036B-4I for submit@debbugs.gnu.org; Sun, 05 Feb 2023 04:43:16 -0500 Received: from lists.gnu.org ([209.51.188.17]:57142) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pObYH-000363-3P for submit@debbugs.gnu.org; Sun, 05 Feb 2023 04:43:15 -0500 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 1pObYG-0003IB-Pc for bug-gnu-emacs@gnu.org; Sun, 05 Feb 2023 04:43:12 -0500 Received: from mail-pj1-x1031.google.com ([2607:f8b0:4864:20::1031]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pObYF-0000xD-A9; Sun, 05 Feb 2023 04:43:12 -0500 Received: by mail-pj1-x1031.google.com with SMTP id pj3so9020517pjb.1; Sun, 05 Feb 2023 01:43:10 -0800 (PST) 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=wjC3n9KtrQcGiaONNNf0yt7x2dQ+v1qreH0052Zn6/g=; b=NMDQkEkkh5YsOj+yTAKazoQ3RUjFnn9f6LgXq/xTpY99ld5T9Mk6zN0dYayJD1Cp4h KYU73tEQb8QHEye3cML8wll0tdWUush7JUCW7FKZcD6lVyX/rXO+MCnh0O+twiQB2LQj zLrHL7Yq2003HXA7k/inSlyI+ScDAjJ9pphSOTB9IIjsiu+j941NRa4Nm0rjwJ/R8e/e jdU2UnValYEMMtrfODNKGG0h+iEnrRDsBnb4de5QlJYFJQT64gK2pixKEsVpMHM/bP3f XsNSEgMqY0DslF6Fv4gMQoNBpH/bsL5b7z8HMvAqkl2n02ujxI7euSE5fN0JxqFxEQwq xwkg== 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=wjC3n9KtrQcGiaONNNf0yt7x2dQ+v1qreH0052Zn6/g=; b=afLE5Av0ginYMyWzgMmSfOP47LM3639/uSTwX7bUv3Y2F6Dk5pQ+1GYuglN27dxAMR Ivwor0FOadcLOz+gcnmioqb+yYeeirib3k6IcsfHERtJ7YAw548JSKp97YAjStJ5rcTE WzEcDLEjyNJ/FqJD3v/NYhRgVNMeRsJ8cPLhik0m1LiFN5ZhQxT2Vl6lp7yRxLAbsvPw XqZZg44tue3VIkqlzIB2RgaH1Xh+dulZsARoENX7h0FYc/lyVTjqpAucDSdo1CqRguVw 3pcSOHwXlw60dbBUMJO742Qag5Ej2pCI92PoV6oya9haxl1ypuUfv4+wEVk58Yt5ZuDX SWMg== X-Gm-Message-State: AO0yUKVLUibzeUj8bOrdDAhmGKXRVZj4pyMZ5TNmP6CRv9qzd7g3Apts WJwLoBLFEnuOzOxVUDNB6S65CRLO5as= X-Google-Smtp-Source: AK7set+CCkm1kCyTXdCNQUKege3maU5zVajkcqBcIg75TVeY0DdcqjwFw6SWyMCe1ld1IPxcWMKA+Q== X-Received: by 2002:a05:6a20:69a1:b0:bc:3250:9fa4 with SMTP id t33-20020a056a2069a100b000bc32509fa4mr20065979pzk.41.1675590189188; Sun, 05 Feb 2023 01:43:09 -0800 (PST) Received: from smtpclient.apple (cpe-172-117-161-177.socal.res.rr.com. [172.117.161.177]) by smtp.gmail.com with ESMTPSA id i64-20020a639d43000000b0044ed37dbca8sm4288013pgd.2.2023.02.05.01.43.08 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sun, 05 Feb 2023 01:43:08 -0800 (PST) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3731.300.101.1.3\)) From: Yuan Fu In-Reply-To: <83ilggsbxo.fsf@gnu.org> Date: Sun, 5 Feb 2023 01:42:57 -0800 Content-Transfer-Encoding: quoted-printable Message-Id: References: <83tu0kkuqo.fsf@gnu.org> <7B62BDA1-C46B-4373-B3A7-2F9E34F3D803@gmail.com> <83tu03ur55.fsf@gnu.org> <83zg9sslat.fsf@gnu.org> <1CC382C7-8663-4F12-9163-916EE1FFCFBB@gmail.com> <83ilggsbxo.fsf@gnu.org> X-Mailer: Apple Mail (2.3731.300.101.1.3) Received-SPF: pass client-ip=2607:f8b0:4864:20::1031; envelope-from=casouri@gmail.com; helo=mail-pj1-x1031.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-Spam-Score: -1.3 (-) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.3 (--) > On Feb 5, 2023, at 1:23 AM, Eli Zaretskii wrote: >=20 >> From: Yuan Fu >> Date: Sat, 4 Feb 2023 23:54:56 -0800 >> Cc: Bug Report Emacs , >> theo@thornhill.no >>=20 >>> Yes, that's how I understood what you were saying: changing the list >>> of features enabled/disabled by specific levels. This is not a >>> user-level thing, so describing it in the ELisp manual is good = enough, >>> I think. (If it turns out users want to do this kind of thing too >>> often, it probably means our design of the user-facing features is >>> sub-optimal and should be improved.) >>=20 >> I see, my description and the documentation is still not clear = enough, I=E2=80=99m afraid. treesit-font-lock-recompute-feature does not = add/remove features that belongs to a level. The design is that, the = user uses decoration level to set the rough level, which enables a set = of features, then use treesit-font-lock-recompute-feature to do more = fine-grained control by additionally enabling/disabling features.=20 >>=20 >> For example in c-ts-mode, if I set the decoration level to 2, I=E2=80=99= d have these features: comment, definition, keyword, preprocessor, = string, type. If I also want the assignment features, which is in level = 3, but don=E2=80=99t want other features in level 3, I would use = treesit-font-lock-recompute-feature to enable that feature. Similarly, I = can use treesit-font-lock-recompute-feature to disable the preprocessor = which is at level 2, without affecting other features status. >=20 > That's exactly what I understood, and that was what I responded to. I > don't think it's a user-level feature to tweak the list of features > that are enabled/disables by a certain decoration level. It is on the > level of Lisp programming, and therefore should be described in the > ELisp manual. Oh! All is well, then :-) Yuan=