From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: =?UTF-8?Q?=C3=93scar?= Fuentes Newsgroups: gmane.emacs.bugs Subject: bug#71086: 30.0.50; Setting treesit-indent-function is not effective is treesit-simple-indent-rules is nil Date: Tue, 21 May 2024 03:32:05 +0200 Message-ID: <87y184q7ai.fsf@telefonica.net> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="26830"; mail-complaints-to="usenet@ciao.gmane.io" To: 71086@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Tue May 21 03:33:20 2024 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1s9ENT-0006gQ-Qy for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 21 May 2024 03:33:19 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1s9ENC-000593-Az; Mon, 20 May 2024 21:33:02 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1s9EN9-0004pN-HD for bug-gnu-emacs@gnu.org; Mon, 20 May 2024 21:33:00 -0400 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1s9EN9-0005p4-1X for bug-gnu-emacs@gnu.org; Mon, 20 May 2024 21:32:59 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1s9ENC-0005FR-Mw for bug-gnu-emacs@gnu.org; Mon, 20 May 2024 21:33:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: =?UTF-8?Q?=C3=93scar?= Fuentes Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 21 May 2024 01:33:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 71086 X-GNU-PR-Package: emacs X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.171625515620155 (code B ref -1); Tue, 21 May 2024 01:33:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 21 May 2024 01:32:36 +0000 Original-Received: from localhost ([127.0.0.1]:46082 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1s9EMm-0005F1-Dp for submit@debbugs.gnu.org; Mon, 20 May 2024 21:32:36 -0400 Original-Received: from lists.gnu.org ([209.51.188.17]:34162) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1s9EMj-0005Ev-Td for submit@debbugs.gnu.org; Mon, 20 May 2024 21:32:35 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1s9EMe-0003IB-LO for bug-gnu-emacs@gnu.org; Mon, 20 May 2024 21:32:28 -0400 Original-Received: from relayout01-redir.e.movistar.es ([86.109.101.201]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1s9EMa-0005V6-Rj for bug-gnu-emacs@gnu.org; Mon, 20 May 2024 21:32:28 -0400 Original-Received: from sky (81.red-81-39-130.dynamicip.rima-tde.net [81.39.130.81]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: 981711563@telefonica.net) by relayout01.e.movistar.es (Postfix) with ESMTPSA id 4VjxkG3X9HzfcbT for ; Tue, 21 May 2024 03:32:06 +0200 (CEST) X-TnetOut-Country: IP: 81.39.130.81 | Country: ES X-TnetOut-Information: AntiSPAM and AntiVIRUS on relayout01 X-TnetOut-MsgID: 4VjxkG3X9HzfcbT.AAD46 X-TnetOut-SpamCheck: no es spam, clean X-TnetOut-From: ofv@wanadoo.es X-TnetOut-Watermark: 1716859926.80434@gpSdY53wPHO5hCm13SlNLA Received-SPF: softfail client-ip=86.109.101.201; envelope-from=ofv@wanadoo.es; helo=relayout01-redir.e.movistar.es X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_SOFTFAIL=0.665 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:285511 Archived-At: treesit-major-mode-setup setups indentation if and only if treesit-simple-indent-rules is non-nil. So the major mode author is forced to set that variable even when he makes no use of the treesit-simple-indent facilities and instead sets treesit-indent-function to his own function. Having to assign a dummy value to a variable that belongs to an API that is not used is surprising. Furthermore, it is unspecified what kind of values are acceptable on that scenario. I would expect that treesit-major-mode-setup shall setup indentation when treesit-indent-function is non-nil. OTOH, the info node for "Parser-based Indentation" says: To enable the parser-based indentation engine, either set =E2=80=98treesit-simple-indent-rules=E2=80=99 and call =E2=80=98treesit-m= ajor-mode-setup=E2=80=99, or equivalently, set the value of =E2=80=98indent-line-function=E2=80=99 to =E2=80=98treesit-indent=E2=80=99. However, treesit-major-mode-setup does more than what's described after "equivalently": (when treesit-simple-indent-rules (setq-local treesit-simple-indent-rules (treesit--indent-rules-optimize treesit-simple-indent-rules)) (setq-local indent-line-function #'treesit-indent) (setq-local indent-region-function #'treesit-indent-region)) In GNU Emacs 30.0.50 (build 1, x86_64-pc-linux-gnu, X toolkit, cairo version 1.18.0) of 2024-05-19 built on sky Repository revision: 98b83bdc9f4af7798e3314ad8df6ab78efd60f8a Repository branch: master Windowing system distributor 'The X.Org Foundation', version 11.0.12101011 System Description: Debian GNU/Linux trixie/sid Configured using: 'configure --with-native-compilation --without-toolkit-scroll-bars --with-x-toolkit=3Dlucid --with-modules --without-imagemagick' Configured features: CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GSETTINGS HARFBUZZ JPEG LIBOTF LIBSELINUX LIBXML2 MODULES NATIVE_COMP NOTIFY INOTIFY PDUMPER PNG RSVG SECCOMP SOUND THREADS TIFF TREE_SITTER WEBP X11 XAW3D XDBE XIM XINPUT2 XPM LUCID ZLIB Important settings: value of $LANG: C locale-coding-system: nil