From unknown Sun Jun 15 08:53:36 2025 X-Loop: help-debbugs@gnu.org Subject: bug#62717: 29.0.60; c-ts-mode does not indent the first line in a function after RET Resent-From: Daniel =?UTF-8?Q?Mart=C3=ADn?= Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 07 Apr 2023 19:50:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 62717 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: 62717@debbugs.gnu.org X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.168089694922377 (code B ref -1); Fri, 07 Apr 2023 19:50:01 +0000 Received: (at submit) by debbugs.gnu.org; 7 Apr 2023 19:49:09 +0000 Received: from localhost ([127.0.0.1]:57269 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pks57-0005or-FR for submit@debbugs.gnu.org; Fri, 07 Apr 2023 15:49:09 -0400 Received: from lists.gnu.org ([209.51.188.17]:38892) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pks56-0005ok-Dj for submit@debbugs.gnu.org; Fri, 07 Apr 2023 15:49:08 -0400 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 1pks50-0002eP-Go for bug-gnu-emacs@gnu.org; Fri, 07 Apr 2023 15:49:06 -0400 Received: from sonic314-20.consmr.mail.ir2.yahoo.com ([77.238.177.146]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pks4y-0000NO-Fv for bug-gnu-emacs@gnu.org; Fri, 07 Apr 2023 15:49:02 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.es; s=s2048; t=1680896931; bh=xGTEMA7VWS0sS43zzOHkT7PiHA+DgFRU1BKRxCAeTTQ=; h=From:To:Subject:Date:References:From:Subject:Reply-To; b=ObAPYSMXu0CSkwVCElxQRHghnu3ZVs2cZ0focxpL/VWRNlY7mtqGD6qiYXNZjeBLitqQLuSETEIhCumAP8aOVPXySFM8NSjFUK5fLirR962a/U4gdvBgIvDQ0ZJe481yRNhYgD3EWK0LT7bR9lT4Sj+A955chLY7z0n7El2xD8+g2VulOsZZhITGXBv4J0Ay+1PObLQoxr8ZgwLHyAShiEgu6fzMWASQP8pDBOJ48rKAce2Di9niQYh+o4pBHIxOXiMjPjxXcN4ivx0wsIkbYOgCZgwfR4IWCLsQgzwT43WSuWGk6qK7EIeTx2xhB/USOJsEmsTf3b9WzdQZQdx9lw== X-SONIC-DKIM-SIGN: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1680896931; bh=N7ePH33nDpY9OUQJvtoxwJex2bMHZ66m//xtmrv2rjx=; h=X-Sonic-MF:From:To:Subject:Date:From:Subject; b=T0hp0qIMib548AIyAOs+kJ0j+w53qcpMQLqNXv4eaB4Cfy53+hlsjDw897UEcQW6TZz3l9ad4t72OkcP55ojBeTCOME3+cIByDjH3lPTX/e/dvmfUNHp1veIMnhUiBJ+ZRdfKAmY5yqr1q1uXNOnkuKTRwM814pmCNOFB8H5Mvui+TD2DEuXnU6Fu7TDTjkP2kaRkMs6eHlGR/naXlrA9XGPjhy7otG7fiW4kVIIn/N1uDS0nmmX2P3HDLR+9XLEcwyl8vvWcNoBrPG+pM50ig317hE0HKzMnfY7hgWBM9ympvAuK86fd36hUUn4Ri2NJNb/0ZkwAE5Er8ljv5wndw== X-YMail-OSG: kuYqIoQVM1keVaJBDVxxN8jTedHsJAWr25lxTsy4LOwbEW0TazbvUezfw.EMhAn 7.yvXCwMkuoJhmrYrbyEoFVU47q0OkSV5pmWm3PDpqea.73OXS05gvLkSXY.dMrv7ZDb.vruLKIg sLPj15bkMWAr2DPS4.1UDn5P4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Sonic-ID: f60484cb-4e57-4504-abe7-1579bea876ed Received: from sonic.gate.mail.ne1.yahoo.com by sonic314.consmr.mail.ir2.yahoo.com with HTTP; Fri, 7 Apr 2023 19:48:51 +0000 Received: by hermes--production-ir2-74cd8fc864-d5c78 (Yahoo Inc. Hermes SMTP Server) with ESMTPA ID bbb88cabdb34bbf91d088bc7174f0a60; Fri, 07 Apr 2023 19:48:49 +0000 (UTC) From: Daniel =?UTF-8?Q?Mart=C3=ADn?= Date: Fri, 07 Apr 2023 21:48:48 +0200 Message-ID: MIME-Version: 1.0 Content-Type: text/plain References: X-Mailer: WebService/1.1.21365 mail.backend.jedi.jws.acl:role.jedi.acl.token.atz.jws.hermes.yahoo Content-Length: 797 Received-SPF: pass client-ip=77.238.177.146; envelope-from=mardani29@yahoo.es; helo=sonic314-20.consmr.mail.ir2.yahoo.com 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, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, 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 (--) emacs -Q C-x b sample.c RET M-x c-ts-mode RET int main() { If I press RET at the end of the line, the point is not indented. The Tree-sitter tree for the code is (translation_unit (function_definition type: (primitive_type) declarator: (function_declarator declarator: (identifier) parameters: (parameter_list ( ))) body: (compound_statement { }))) If I insert a closing bracket, that is: int main() { } The newline indents correctly. The Tree-sitter tree is now (function_definition type: (primitive_type) declarator: (function_declarator declarator: (identifier) parameters: (parameter_list ( ))) body: (compound_statement { })) It seems that Tree-sitter parses both code snippets without errors and Emacs should automatically indent after RET in the first case. From unknown Sun Jun 15 08:53:36 2025 X-Loop: help-debbugs@gnu.org Subject: bug#62717: 29.0.60; c-ts-mode does not indent the first line in a function after RET Resent-From: Dmitry Gutov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 08 Apr 2023 07:17:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 62717 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Daniel =?UTF-8?Q?Mart=C3=ADn?= , 62717@debbugs.gnu.org Cc: Yuan Fu , Theodor Thornhill Received: via spool by 62717-submit@debbugs.gnu.org id=B62717.168093818531323 (code B ref 62717); Sat, 08 Apr 2023 07:17:02 +0000 Received: (at 62717) by debbugs.gnu.org; 8 Apr 2023 07:16:25 +0000 Received: from localhost ([127.0.0.1]:57577 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pl2oC-000894-Um for submit@debbugs.gnu.org; Sat, 08 Apr 2023 03:16:25 -0400 Received: from wnew2-smtp.messagingengine.com ([64.147.123.27]:36981) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pkxq7-0007Or-LJ for 62717@debbugs.gnu.org; Fri, 07 Apr 2023 21:58:04 -0400 Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailnew.west.internal (Postfix) with ESMTP id 87B5D2B066E5; Fri, 7 Apr 2023 21:57:57 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute5.internal (MEProxy); Fri, 07 Apr 2023 21:57:57 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gutov.dev; h=cc :cc:content-transfer-encoding:content-type:content-type:date :date:from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:sender:subject:subject:to:to; s=fm1; t= 1680919077; x=1680922677; bh=1yy97GauIA8Kq+rwgGUROaF9x8DmIfj/Iq7 Yt6FfUW4=; b=cyaPYxWqNCwDpCmESZN3rivSqfJOYEECE/pqDurdaLqtc/rfTlF 743nCjsCOH/WsKcbbhSoXP6iurdMvliQlqUjoShoOA9PkA6/ewHTqa92y31FgWfl 5a83WM31NNFIvyl7qa1hkNiUtFk4fBVHkQYQW5cuDNcvL1F7aPdCOBxGA8E+OQk+ w1dyn+VUOW/PhnCiuEigMRP44ZQZZjG53T7l1nC6LBIo1fL+Q5DNbcFHuIh8M9cE w4kPUpa24DItWem9rE9fT2ede6YFtuQd3NEGRagsomnVSQy6QeMaJx5AMdASTdMe FV8ih1N+7OY4CyubymeJBO+IlR9Xx4G3PDg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:sender:subject:subject:to:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm2; t= 1680919077; x=1680922677; bh=1yy97GauIA8Kq+rwgGUROaF9x8DmIfj/Iq7 Yt6FfUW4=; b=TDHN23FHazd4wwANcX3el4qa7yUdBSEayhyh9poSn7qaLPu5DQ1 jIOlxRpHbvYwcd3SEP4El0MUnz02Oi6QhsNFMiHMMMDGUhiYviVgupSp8ih2RQxx TmhsfjV7SzX4Oxs3FpslgEM8C4k20WAqp5GZr1hX7ujzIf1WJwlKkRWP6gJU/ejW VUSdHaljYy7HiJLWWeB3klsyyidLWtJeMgeQcpI3XRAt6mPx8EFHvmrlJf1nMbl/ WNRD5QDbQyCSeHrV3oIeO/4HXCqfnyXKtk+/iEY7XuM/6bjhZLmd88Sf2f24Upjg ReixTFqmv4gFPOD32ODSN87aM5K2BAMkKhQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvhedrvdejiedghedtucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepkfffgggfuffvfhevhfgjtgfgsehtkeertddtfeejnecuhfhrohhmpeffmhhi thhrhicuifhuthhovhcuoegumhhithhrhiesghhuthhovhdruggvvheqnecuggftrfgrth htvghrnhepfeeiueehvdfguefguefhlefgkeejudevteelgedvgfeftedtudevjeefudel udfhnecuffhomhgrihhnpehgihhthhhusgdrtghomhenucevlhhushhtvghrufhiiigvpe dtnecurfgrrhgrmhepmhgrihhlfhhrohhmpegumhhithhrhiesghhuthhovhdruggvvh X-ME-Proxy: Feedback-ID: i0e71465a:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Fri, 7 Apr 2023 21:57:55 -0400 (EDT) Message-ID: Date: Sat, 8 Apr 2023 04:57:53 +0300 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.9.0 Content-Language: en-US References: From: Dmitry Gutov In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Score: -1.1 (-) X-Mailman-Approved-At: Sat, 08 Apr 2023 03:16:22 -0400 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.1 (--) On 07/04/2023 22:48, Daniel Martín via Bug reports for GNU Emacs, the Swiss army knife of text editors wrote: > emacs -Q > C-x b sample.c RET > M-x c-ts-mode RET > > int main() { > > If I press RET at the end of the line, the point is not indented. > > The Tree-sitter tree for the code is > > (translation_unit > (function_definition type: (primitive_type) > declarator: > (function_declarator declarator: (identifier) > parameters: (parameter_list ( ))) > body: (compound_statement { }))) > > If I insert a closing bracket, that is: > > int main() { > } > > The newline indents correctly. The Tree-sitter tree is now > > (function_definition type: (primitive_type) > declarator: > (function_declarator declarator: (identifier) > parameters: (parameter_list ( ))) > body: (compound_statement { })) > > It seems that Tree-sitter parses both code snippets without errors and > Emacs should automatically indent after RET in the first case. I've looked at what nvim-treesitter does for indentation, and at least one of the steps looks like this: https://github.com/nvim-treesitter/nvim-treesitter/blob/584ccea56e2d37b31ba292da2b539e1a4bb411ca/lua/nvim-treesitter/indent.lua#L129-L134 If the current line is empty, look at the end of the previous line and compute based on the node there. I'm not sure how this meshes with the fact that tree-sitter inserts a "virtual" closer node at the end of the previous line, but the approach is worth examining. Daniel, you posted about testing nvim-treesitter with several scenarios. Does it do the right thing with this one? From unknown Sun Jun 15 08:53:36 2025 X-Loop: help-debbugs@gnu.org Subject: bug#62717: 29.0.60; c-ts-mode does not indent the first line in a function after RET Resent-From: Daniel =?UTF-8?Q?Mart=C3=ADn?= Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 08 Apr 2023 18:39:03 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 62717 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Dmitry Gutov Cc: Theodor Thornhill , Yuan Fu , 62717@debbugs.gnu.org Received: via spool by 62717-submit@debbugs.gnu.org id=B62717.168097908424754 (code B ref 62717); Sat, 08 Apr 2023 18:39:03 +0000 Received: (at 62717) by debbugs.gnu.org; 8 Apr 2023 18:38:04 +0000 Received: from localhost ([127.0.0.1]:59510 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1plDRr-0006RC-Sl for submit@debbugs.gnu.org; Sat, 08 Apr 2023 14:38:04 -0400 Received: from sonic304-22.consmr.mail.ir2.yahoo.com ([77.238.179.147]:32989) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1plDRo-0006Qf-JT for 62717@debbugs.gnu.org; Sat, 08 Apr 2023 14:38:02 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.es; s=s2048; t=1680979073; bh=uf54mie5aKGG45bvSH7qZkky8cJIa79evNOvSDuiuJ4=; h=From:To:Cc:Subject:References:Date:In-Reply-To:From:Subject:Reply-To; b=pYsVuM9/nWUGemJMKT3nHEE383lIRF2PIZcmTK8Kk5qsjsajzYg27hqOompHlwBzfGFymednEdd53IfyBFkXUiVUWWuXyVlvGoyxESqFGHbFe6JiONPP+cnFmUjddqGNnTWSBkHsYuTRArOd/Uhisg91kT/gjrN49Szzwf8eCtJwKiN/imh4hZELDte2iBkBPVty34mOXN3FCBqwH2IRiFCgfBDe47+N2G4rL7mElUCL6lfFmcDCvRMdLffJ77WAJIx1shrVACgf02F+YBKms8BSvnMf72o2gSncMvbtvsJZjcna+W3GhkhmvjMDt7Df5qWpQv+VD8PyDBuzxclJhA== X-SONIC-DKIM-SIGN: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1680979073; bh=Be91AQftWTxHu/VaMV93Ir0E3oLGJOWkxLway4+rTp/=; h=X-Sonic-MF:From:To:Subject:Date:From:Subject; b=m3wSFSgnP29sZ7VFmeVwA9nUTCkN3UADgZ+fFelmj5Ov/H2jZxVnRcpNaDo5FtVqahdSTu7LgcU3YfX8IlHhg7FZLH6GT2S6Xn/5Je0QT2iUJCz8j2w2zohhqMnyaMPeLagWKkoiTWU2LP2ASz50tDfJWCN34QGBOMiDhXx4cVr99BD8ci7tl9Z4Mj/yYucktYw8FIsojNh37VjyuiI2GpZL6FoqvtTw+WAyYQw7PlI+YItwR+APyYM4F5ik3Qe2rBVf3yvvl6hfJ186IBk00D6hZbBdp8kodJqj7f6DJIqjPppfHhLejTKC/ORl/BEKQr0iAwkk72zk/QqpMAuxTA== X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sVebetKDroKIP9.4nLh.B83MY81knTc.EpxkjGV8n_HLR6.lK5zWLLGoIU1VlwI_wPC GuC.4Djufn9ZT.RTqpsl_TlrpOOz8SklkevEgQxnrduZbiySLfxPM.q_VGRb.wfYaYhECAoJI7p8 eL76AdIgawP0z7Ya9DPkssgucObgL.9UOYwL86.zziksrUo4- X-Sonic-MF: X-Sonic-ID: c1fa7eeb-ab56-4168-b8cc-4e78c60df4d2 Received: from sonic.gate.mail.ne1.yahoo.com by sonic304.consmr.mail.ir2.yahoo.com with HTTP; Sat, 8 Apr 2023 18:37:53 +0000 Received: by hermes--production-ir2-74cd8fc864-4bl68 (Yahoo Inc. Hermes SMTP Server) with ESMTPA ID c8cd4d0bd6750686f9949c76ca7c278a; Sat, 08 Apr 2023 18:37:52 +0000 (UTC) From: Daniel =?UTF-8?Q?Mart=C3=ADn?= References: Date: Sat, 08 Apr 2023 20:37:50 +0200 In-Reply-To: (Dmitry Gutov's message of "Sat, 8 Apr 2023 04:57:53 +0300") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.2 (darwin) MIME-Version: 1.0 Content-Type: text/plain X-Mailer: WebService/1.1.21365 mail.backend.jedi.jws.acl:role.jedi.acl.token.atz.jws.hermes.yahoo Content-Length: 787 X-Spam-Score: 0.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: -0.7 (/) Dmitry Gutov writes: > > I've looked at what nvim-treesitter does for indentation, and at least > one of the steps looks like this: > > https://github.com/nvim-treesitter/nvim-treesitter/blob/584ccea56e2d37b31ba292da2b539e1a4bb411ca/lua/nvim-treesitter/indent.lua#L129-L134 > > If the current line is empty, look at the end of the previous line and > compute based on the node there. > > I'm not sure how this meshes with the fact that tree-sitter inserts a > "virtual" closer node at the end of the previous line, but the > approach is worth examining. > > Daniel, you posted about testing nvim-treesitter with several > scenarios. Does it do the right thing with this one? Yes, it works well in this scenario. Inserting a new line automatically adds indentation. From unknown Sun Jun 15 08:53:36 2025 X-Loop: help-debbugs@gnu.org Subject: bug#62717: 29.0.60; c-ts-mode does not indent the first line in a function after RET Resent-From: Dmitry Gutov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 09 Apr 2023 04:12:04 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 62717 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Daniel =?UTF-8?Q?Mart=C3=ADn?= Cc: Theodor Thornhill , Yuan Fu , 62717@debbugs.gnu.org, =?UTF-8?Q?Jo=C3=A3o_?= =?UTF-8?Q?T=C3=A1vora?= , Alan Mackenzie Received: via spool by 62717-submit@debbugs.gnu.org id=B62717.168101349716086 (code B ref 62717); Sun, 09 Apr 2023 04:12:04 +0000 Received: (at 62717) by debbugs.gnu.org; 9 Apr 2023 04:11:37 +0000 Received: from localhost ([127.0.0.1]:60007 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1plMOu-0004BI-Uh for submit@debbugs.gnu.org; Sun, 09 Apr 2023 00:11:37 -0400 Received: from wnew1-smtp.messagingengine.com ([64.147.123.26]:44311) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1plInK-00060K-6V for 62717@debbugs.gnu.org; Sat, 08 Apr 2023 20:20:35 -0400 Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailnew.west.internal (Postfix) with ESMTP id 8A04F2B06841; Sat, 8 Apr 2023 20:20:27 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute1.internal (MEProxy); Sat, 08 Apr 2023 20:20:28 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gutov.dev; h=cc :cc:content-transfer-encoding:content-type:content-type:date :date:from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:sender:subject:subject:to:to; s=fm1; t= 1680999627; x=1681003227; bh=oxlJmRKkPY4lNOteoCHDbyFGh+j//LIhqQ4 4gcUcDQc=; b=k2rQ17QTV9TrXrHjXUIVeNagFDydD3roT9qvZZbDzgyGrHikaCW REpFQ3fxWcTVOwWI3I9UgF+udpfJ8Futh/Osn2fjWAnqvhGA6rxG++7PaLjXfIQ7 +FHQpeLmzVT8aZ2NkQjlTyM8qwaIvj10PriCXZdasZdKJ1Lvz8y3wdVfLFNH+erF Bzz5mAVBJaoVWw0L1vRRRRfEqArR4emKdDq3CcAad5pKP/37F3l322NpzqPuo0d3 BxrzU7/y+jVJpGKifBPeQbKnD8ditqcGPgGO/HBftveFJQrS4XCHoTiib30md4jv 3lpL/8Kx5exfOR3p0krEjAbQo/ZpqoZyGRA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:sender:subject:subject:to:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm2; t= 1680999627; x=1681003227; bh=oxlJmRKkPY4lNOteoCHDbyFGh+j//LIhqQ4 4gcUcDQc=; b=fr4nY5ToI3H8hauCnv9YOBnfdliBcKTWvlR3j87ZkTPwDf2yPQq wbh//7VjBU7ReH4cQss40azrwhh54tt6NE7irGaEnHdnck0WIFE2XoXN4BdEgIS0 Y484YXfR1ihoKamAIYxKyrAOqH2xKs7imH7EBWl+XZkbyew7lhtseGNTKf7FcuFF i6l7oWZ1Zo/IsLI9WcDqykpSCvb5+48tMUwL9uYtYRERNq7GNTZMSYO+RiGjXbwM cyZvZSMlNyPgVe046gyvM98tPXj/IJGP8T3wkgPSriOCkJSrmm5YUrGJhshjoZ4V hGYDVD5CE/Y/WQ7o90SubWprMFyXQEgldsw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvhedrvdejkedgfeefucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepkfffgggfuffvvehfhfgjtgfgsehtkeertddtfeejnecuhfhrohhmpeffmhhi thhrhicuifhuthhovhcuoegumhhithhrhiesghhuthhovhdruggvvheqnecuggftrfgrth htvghrnhepueffveeiffeugffgveejvdegteeuhfdugfehleelfeejtdelteethfdtieeg vddunecuffhomhgrihhnpehgihhthhhusgdrtghomhenucevlhhushhtvghrufhiiigvpe dtnecurfgrrhgrmhepmhgrihhlfhhrohhmpegumhhithhrhiesghhuthhovhdruggvvh X-ME-Proxy: Feedback-ID: i0e71465a:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Sat, 8 Apr 2023 20:20:24 -0400 (EDT) Message-ID: Date: Sun, 9 Apr 2023 03:20:23 +0300 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.9.0 Content-Language: en-US References: From: Dmitry Gutov In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Score: -1.1 (-) X-Mailman-Approved-At: Sun, 09 Apr 2023 00:11:32 -0400 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.1 (--) On 08/04/2023 21:37, Daniel Martín wrote: > Dmitry Gutov writes: > >> I've looked at what nvim-treesitter does for indentation, and at least >> one of the steps looks like this: >> >> https://github.com/nvim-treesitter/nvim-treesitter/blob/584ccea56e2d37b31ba292da2b539e1a4bb411ca/lua/nvim-treesitter/indent.lua#L129-L134 >> >> If the current line is empty, look at the end of the previous line and >> compute based on the node there. >> >> I'm not sure how this meshes with the fact that tree-sitter inserts a >> "virtual" closer node at the end of the previous line, but the >> approach is worth examining. >> >> Daniel, you posted about testing nvim-treesitter with several >> scenarios. Does it do the right thing with this one? > Yes, it works well in this scenario. Inserting a new line automatically > adds indentation. All right. From reading the code, it looks like a semi-coincidence that this example works fine: the algorithm is just different, looking for indent/dedent nodes, there is nothing similar to our logic in treesit--indent-1. Which can be good and bad, but it's likely that the grammar (and tree-sitter itself) co-evolved together with that approach, so it's no surprise the sharp edges match. In particular, the virtual closer node seems to be skipped because the search uses descendant_for_range, which seems to jump over zero-length nodes. We could try to hammer in that exception as a workaround, but the resulting PARENT won't contain BOL anyway, and it's not 100% clear how these fake nodes will look for other grammars. Indentation in ruby-ts-mode, for example, won't magically start working right away in the comparable situation (method definition without closer) because there is also a missing body_statement node, requiring further changes to indentation rules. What does this mean for us? Short of reimplementing nvim-treesitter's algorithm (and I haven't read Atom's or Zed's indentation code; anybody's welcome to chime in with a summary of either), we could just install the patch at the end of this message: it fixes this particular case, in a bit hackish way, but at least it doesn't affect other languages. Note that it still doesn't fix very similar cases, e.g. int main () { for (;;) { (we need additional rules looking for ERROR nodes, like in nvim's indent.scm), but in does fix int main () { for (;;) {} and int main () { int foo; I'm not sure, though, what is the big deal with adding the top-level function's closing curly first thing before writing the body (after that the parser starts working much better), so as far as I'm concerned this patch is very optional. It does add some complexity, after all. Adding Alan and Joao, who were interested in this scenario as well. diff --git a/lisp/progmodes/c-ts-mode.el b/lisp/progmodes/c-ts-mode.el index 981c7766375..9aaa8b32c73 100644 --- a/lisp/progmodes/c-ts-mode.el +++ b/lisp/progmodes/c-ts-mode.el @@ -859,6 +859,18 @@ c-ts-mode--defun-skipper (goto-char (match-end 0))) (treesit-default-defun-skipper)) +(defun c-ts-base--before-indent (args) + (pcase-let ((`(,node ,parent ,bol) args)) + (when (null node) + (let ((smallest-node (treesit-node-at (point)))) + ;; "Virtual" closer curly added by the + ;; parser's error recovery. + (when (and (equal (treesit-node-type smallest-node) "}") + (equal (treesit-node-end smallest-node) + (treesit-node-start smallest-node))) + (setq parent (treesit-node-parent smallest-node))))) + (list node parent bol))) + (defun c-ts-mode-indent-defun () "Indent the current top-level declaration syntactically. @@ -904,6 +916,8 @@ c-ts-base-mode ;; function_definitions, so we need to find the top-level node. (setq-local treesit-defun-prefer-top-level t) + (add-function :filter-args treesit-indent-function #'c-ts-base--before-indent) + ;; Indent. (when (eq c-ts-mode-indent-style 'linux) (setq-local indent-tabs-mode t)) From unknown Sun Jun 15 08:53:36 2025 X-Loop: help-debbugs@gnu.org Subject: bug#62717: 29.0.60; c-ts-mode does not indent the first line in a function after RET Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 09 Apr 2023 05:19:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 62717 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Dmitry Gutov Cc: casouri@gmail.com, theo@thornhill.no, 62717@debbugs.gnu.org, mardani29@yahoo.es, joaotavora@gmail.com, acm@muc.de Received: via spool by 62717-submit@debbugs.gnu.org id=B62717.168101753524586 (code B ref 62717); Sun, 09 Apr 2023 05:19:01 +0000 Received: (at 62717) by debbugs.gnu.org; 9 Apr 2023 05:18:55 +0000 Received: from localhost ([127.0.0.1]:60147 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1plNS3-0006OT-8K for submit@debbugs.gnu.org; Sun, 09 Apr 2023 01:18:55 -0400 Received: from eggs.gnu.org ([209.51.188.92]:33202) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1plNS1-0006OG-Bs for 62717@debbugs.gnu.org; Sun, 09 Apr 2023 01:18:53 -0400 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 1plNRu-00042W-2M; Sun, 09 Apr 2023 01:18:46 -0400 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=1KujoAM29vyK3SgLYFY/IichzWpOGHN+P+cLQFO+Ps4=; b=ZWeGebelk2LnYzYI+i5h No17DXZbcqOO4MChhN+gX6/zE284BrkLfIMz5ODIBYoTh+ENvrlzvL9wcagggQJOMn2pCWbe+h5/T +d9nln20b3cJxrzZeHm1GJdtRqDxb/btjBrAgcQ7ZOdf/0IaCfwEDdqNdndied4PAVw44z9YSLIQE XHkTDzX13JsHiQuoGBaTMpIw+KfE0Ct/5DpjpbuSOtpjEgScdytLj3EPSSxmhnemz+pPDKEqnDJAC VqAg3JvbuftnIDRSfllzIFFisnZG1FeBViA7uBv2YFkMJ30w5r5NAnl9s/OcejlYgYVtXaiRERZtJ pE470RmfuWAjVQ==; 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 1plNRt-0002eI-B3; Sun, 09 Apr 2023 01:18:45 -0400 Date: Sun, 09 Apr 2023 08:19:20 +0300 Message-Id: <83a5zhmy3r.fsf@gnu.org> From: Eli Zaretskii In-Reply-To: (message from Dmitry Gutov on Sun, 9 Apr 2023 03:20:23 +0300) References: 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 (---) > Cc: Theodor Thornhill , Yuan Fu , > 62717@debbugs.gnu.org, > João Távora , > Alan Mackenzie > Date: Sun, 9 Apr 2023 03:20:23 +0300 > From: Dmitry Gutov > > What does this mean for us? Short of reimplementing nvim-treesitter's > algorithm (and I haven't read Atom's or Zed's indentation code; > anybody's welcome to chime in with a summary of either), we could just > install the patch at the end of this message: it fixes this particular > case, in a bit hackish way, but at least it doesn't affect other languages. > > Note that it still doesn't fix very similar cases, e.g. > > int main () { > for (;;) { > > (we need additional rules looking for ERROR nodes, like in nvim's > indent.scm), but in does fix > > int main () { > for (;;) {} > > and > > int main () { > int foo; > > I'm not sure, though, what is the big deal with adding the top-level > function's closing curly first thing before writing the body (after that > the parser starts working much better), so as far as I'm concerned this > patch is very optional. It does add some complexity, after all. If the patch solves some of the problems, passes the test suite, and doesn't introduce any regressions you see, I think you should install it (unless someone here objects). Thanks. From unknown Sun Jun 15 08:53:36 2025 X-Loop: help-debbugs@gnu.org Subject: bug#62717: 29.0.60; c-ts-mode does not indent the first line in a function after RET Resent-From: Daniel =?UTF-8?Q?Mart=C3=ADn?= Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 09 Apr 2023 11:06:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 62717 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Dmitry Gutov Cc: 62717@debbugs.gnu.org, Yuan Fu , Theodor Thornhill , =?UTF-8?Q?Jo=C3=A3o_?= =?UTF-8?Q?T=C3=A1vora?= , Alan Mackenzie Received: via spool by 62717-submit@debbugs.gnu.org id=B62717.16810383335549 (code B ref 62717); Sun, 09 Apr 2023 11:06:01 +0000 Received: (at 62717) by debbugs.gnu.org; 9 Apr 2023 11:05:33 +0000 Received: from localhost ([127.0.0.1]:60313 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1plSrU-0001RR-O3 for submit@debbugs.gnu.org; Sun, 09 Apr 2023 07:05:33 -0400 Received: from sonic313-20.consmr.mail.ir2.yahoo.com ([77.238.179.187]:35277) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1plSrR-0001R6-Dq for 62717@debbugs.gnu.org; Sun, 09 Apr 2023 07:05:30 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.es; s=s2048; t=1681038322; bh=7EGIcyVl42VminOCfFRTV/c7rNJFV6i31bB+B/xPatA=; h=From:To:Cc:Subject:References:Date:In-Reply-To:From:Subject:Reply-To; b=VaLVkUfOvp/cnBNiwS7iR2pd+aQeNYOhIqgu+lqKlFTcmZMiDWGtSmsAOTCvj7x7EGQMXkqPNFN0tN9AUMe1etNqB4h/JkPMGNgMsWiyNzW2AoI8l/T6S7kl7oiHMKcbyIdg0APSmRraMrzgMRgN2eK1PeA5DBflB6kcK89KOErakKES6jorrv4+/yMefMu0wh11JIaLGlU0rgQw/UtSzC4izQBzqOOb6PPMaHTLX3qfl1vHbNZQ+skQpckE86Fsa210j8wL7fpQNjVBC47Q4rPc/1UEztxqHb2uEpwCjw2WDs830cKK8wmB6WOqn8JJvpjzjfu33ZwJ65/zm2J5Ww== X-SONIC-DKIM-SIGN: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1681038322; bh=XYYHEuQ+trUCbzT7zjWCYIC7uqkqAe8YT6TB0F0BlHF=; h=X-Sonic-MF:From:To:Subject:Date:From:Subject; b=MSbosdmS8PtcJ2sqngZtIeeQ4CGO7i6QALuPr1fOEqtqZ9t1yTP5idaNAR9BV59e7Eyqf6DDUZXYGmI1pVHODrABWwDCgpVpXp4gz4DH97iPVj2uDxMkL+LIHT8gbYFMkuo6CfZ2zciYPaCxpLbe+U4Qx3oVbh6aDSW4Njp78/WHSZoJFoOoshVwYdEAdAwxF0FbM5FJBf2pafTfbJR3FzVuvEd8MwruRY/EMWLddEHCxXl9+wHrUxs+MZllV5a4R1+/Z85T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IokSuLgGWEl5hy23DwAJ7fbth5Sw3VB08qeDmZMjM0y OTRywZn2yd1cJKwYV9FLzMQfFVw1zNWI2GYh_eY2TodI9VUEIb7J7LsROlpvkubhxguGNDhJTl8c xkL7aGiFjPSAtXt41Cw1cwYVKvsESWoPnWVSmbnUAnIJl6z_l8jIc0vh1GdoO65Ghw1128zHyNrl 86qggvVgFvr7n3kLd7WZATHKq1.gTcunIRS8_2vLjTY6QhwY- X-Sonic-MF: X-Sonic-ID: bd6090b7-a1e1-4a12-8751-0da34a8da29c Received: from sonic.gate.mail.ne1.yahoo.com by sonic313.consmr.mail.ir2.yahoo.com with HTTP; Sun, 9 Apr 2023 11:05:22 +0000 Received: by hermes--production-ir2-74cd8fc864-qfvhg (Yahoo Inc. Hermes SMTP Server) with ESMTPA ID 346f75a99e7ff9aaed3510b08be100af; Sun, 09 Apr 2023 11:05:19 +0000 (UTC) From: Daniel =?UTF-8?Q?Mart=C3=ADn?= References: Date: Sun, 09 Apr 2023 13:05:18 +0200 In-Reply-To: (Dmitry Gutov's message of "Sun, 9 Apr 2023 03:20:23 +0300") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.2 (darwin) MIME-Version: 1.0 Content-Type: text/plain X-Mailer: WebService/1.1.21365 mail.backend.jedi.jws.acl:role.jedi.acl.token.atz.jws.hermes.yahoo Content-Length: 1392 X-Spam-Score: 0.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: -0.7 (/) Dmitry Gutov writes: > > I'm not sure, though, what is the big deal with adding the top-level > function's closing curly first thing before writing the body (after > that the parser starts working much better), so as far as I'm > concerned this patch is very optional. It does add some complexity, > after all. I think this problem also affects languages without curly braces like Ruby or Python. For example, if I insert this Ruby code in a buffer with ruby-ts-mode enabled def sample RET The newline is not indented, but it is indented in ruby-mode. > > Adding Alan and Joao, who were interested in this scenario as well. > > diff --git a/lisp/progmodes/c-ts-mode.el b/lisp/progmodes/c-ts-mode.el > index 981c7766375..9aaa8b32c73 100644 > --- a/lisp/progmodes/c-ts-mode.el > +++ b/lisp/progmodes/c-ts-mode.el Thanks for the patch. It works correctly and the existing c-ts-mode tests pass. I suggest adding a test to prevent regressions: diff --git a/test/lisp/progmodes/c-ts-mode-resources/indent.erts b/test/lisp/progmodes/c-ts-mode-resources/indent.erts index 5cdefe2122c..221b3d809af 100644 --- a/test/lisp/progmodes/c-ts-mode-resources/indent.erts +++ b/test/lisp/progmodes/c-ts-mode-resources/indent.erts @@ -464,3 +464,17 @@ main (void) | } =-=-= + +Name: Empty Line (Block Start) + +=-= +int +main (void) +{ +| +=-= +int +main (void) +{ + | +=-=-= From unknown Sun Jun 15 08:53:36 2025 X-Loop: help-debbugs@gnu.org Subject: bug#62717: 29.0.60; c-ts-mode does not indent the first line in a function after RET Resent-From: Dmitry Gutov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 09 Apr 2023 16:31:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 62717 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Daniel =?UTF-8?Q?Mart=C3=ADn?= Cc: 62717@debbugs.gnu.org, Yuan Fu , Theodor Thornhill , =?UTF-8?Q?Jo=C3=A3o_?= =?UTF-8?Q?T=C3=A1vora?= , Alan Mackenzie Received: via spool by 62717-submit@debbugs.gnu.org id=B62717.168105785431534 (code B ref 62717); Sun, 09 Apr 2023 16:31:01 +0000 Received: (at 62717) by debbugs.gnu.org; 9 Apr 2023 16:30:54 +0000 Received: from localhost ([127.0.0.1]:33575 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1plXwL-0008CY-ND for submit@debbugs.gnu.org; Sun, 09 Apr 2023 12:30:54 -0400 Received: from new3-smtp.messagingengine.com ([66.111.4.229]:59991) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1plXwJ-0008CJ-TG for 62717@debbugs.gnu.org; Sun, 09 Apr 2023 12:30:52 -0400 Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailnew.nyi.internal (Postfix) with ESMTP id 8E7F5581F8E; Sun, 9 Apr 2023 12:30:46 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute3.internal (MEProxy); Sun, 09 Apr 2023 12:30:46 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gutov.dev; h=cc :cc:content-transfer-encoding:content-type:content-type:date :date:from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:sender:subject:subject:to:to; s=fm1; t= 1681057846; x=1681061446; bh=uJmSuKYqztw3zNRUdqu5PPFTBuAF6YaNOnW /o8JXQJ4=; b=jCdyrUhl/V0XXk8gFMnFN4xhghN/TrXMeMFpHop0n1jXIyQevsE 5ZkjSqXZxWCqk9gNadUhvihB9PCkps+CxN6CYX6sK3k6sD8QEnkTuvnSMvb8+LUB +NXjPe79Mhu1LgpVIRbE1PLVCy9RWqKTl9Cxra6NHm51cihbBBsSptfw74n58jHy irgd6cabc05Iuc3PKL87/n//R61JSamD3IoBXIcfMiMCIUdP0gkmtIe96bot6Edx aAcKgYdM+a+TXuBYPsVTh8NQJZoVvD+EY0B3hg6jCe1/QT+72wIju+kWhkhuVHhf 6rwultGhiVgcQoI/VRJMFjcAYberSAH8Ktg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:sender:subject:subject:to:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm2; t= 1681057846; x=1681061446; bh=uJmSuKYqztw3zNRUdqu5PPFTBuAF6YaNOnW /o8JXQJ4=; b=rnP+dDr3xA7/hJkI6SiOZcut99Sny4ebEY5GRixRdHMeUiRkUCS SRFUQ38LPwgTuEnL5OuOXdtDwrfoWIC6Ma11+LmSYcz0Z4nqXlXDws82o/5iX/40 lC5vKOi+Df88qvZr++u1y6IMfPqETX8T9QtJQ5+tXoFgU6WXBtHeivzoXuPosPB9 DkT8m1RSEE4VLgz9ZGaAEZA6j6xnIVqlXOYPeWVlwxbp2Z3N9HaULMVi4KEEnG8n pyJw75qAJRoDJVIkJKJV+P4APNWhJgbf/SaVnrv2ECyqH8kQ7iUlFNSg+5qBEdfh J04Fnsp57bWAwhWH9Trpb25o+JjGvuecSqA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvhedrvdektddguddtfecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd enucfjughrpefkffggfgfuvfevfhfhjggtgfesthekredttdefjeenucfhrhhomhepffhm ihhtrhihucfiuhhtohhvuceoughmihhtrhihsehguhhtohhvrdguvghvqeenucggtffrrg htthgvrhhnpefhffehleejffegffeugefhkeektdffgfehjedvgeejtedtudehueffgffg feejheenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpe gumhhithhrhiesghhuthhovhdruggvvh X-ME-Proxy: Feedback-ID: i0e71465a:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Sun, 9 Apr 2023 12:30:44 -0400 (EDT) Message-ID: Date: Sun, 9 Apr 2023 19:30:43 +0300 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.9.0 Content-Language: en-US References: From: Dmitry Gutov In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Score: -1.1 (-) 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.1 (--) On 09/04/2023 14:05, Daniel Martín wrote: > Dmitry Gutov writes: > >> >> I'm not sure, though, what is the big deal with adding the top-level >> function's closing curly first thing before writing the body (after >> that the parser starts working much better), so as far as I'm >> concerned this patch is very optional. It does add some complexity, >> after all. > > I think this problem also affects languages without curly braces like > Ruby or Python. Python -- no, because it doesn't have closers. And its indentation doesn't use tree-sitter anyway. > For example, if I insert this Ruby code in a buffer with ruby-ts-mode > enabled > > def sample RET > > The newline is not indented, but it is indented in ruby-mode. Right. I mentioned that in the previous email: a fix for ruby-ts-mode will involve a similar (but slightly different) advice together with a new indentation rule. I'm not quite certain yet we want to go there, because a top-level function is more rare in Ruby than in C/C++. And, again, as soon as there is at least once 'end' below the current line in the buffer, things start working much better. The user can either type is manually, or use ruby-end-mode. >> Adding Alan and Joao, who were interested in this scenario as well. >> >> diff --git a/lisp/progmodes/c-ts-mode.el b/lisp/progmodes/c-ts-mode.el >> index 981c7766375..9aaa8b32c73 100644 >> --- a/lisp/progmodes/c-ts-mode.el >> +++ b/lisp/progmodes/c-ts-mode.el > > Thanks for the patch. It works correctly and the existing c-ts-mode > tests pass. I suggest adding a test to prevent regressions: > > diff --git a/test/lisp/progmodes/c-ts-mode-resources/indent.erts b/test/lisp/progmodes/c-ts-mode-resources/indent.erts > index 5cdefe2122c..221b3d809af 100644 > --- a/test/lisp/progmodes/c-ts-mode-resources/indent.erts > +++ b/test/lisp/progmodes/c-ts-mode-resources/indent.erts > @@ -464,3 +464,17 @@ main (void) > | > } > =-=-= > + > +Name: Empty Line (Block Start) > + > +=-= > +int > +main (void) > +{ > +| > +=-= > +int > +main (void) > +{ > + | > +=-=-= Good idea, thanks. From unknown Sun Jun 15 08:53:36 2025 X-Loop: help-debbugs@gnu.org Subject: bug#62717: 29.0.60; c-ts-mode does not indent the first line in a function after RET Resent-From: Dmitry Gutov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 09 Apr 2023 16:34:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 62717 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Eli Zaretskii Cc: casouri@gmail.com, theo@thornhill.no, 62717@debbugs.gnu.org, mardani29@yahoo.es, joaotavora@gmail.com, acm@muc.de Received: via spool by 62717-submit@debbugs.gnu.org id=B62717.168105801131800 (code B ref 62717); Sun, 09 Apr 2023 16:34:01 +0000 Received: (at 62717) by debbugs.gnu.org; 9 Apr 2023 16:33:31 +0000 Received: from localhost ([127.0.0.1]:33580 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1plXyt-0008Gp-Bf for submit@debbugs.gnu.org; Sun, 09 Apr 2023 12:33:31 -0400 Received: from new3-smtp.messagingengine.com ([66.111.4.229]:46383) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1plXyr-0008GZ-AM for 62717@debbugs.gnu.org; Sun, 09 Apr 2023 12:33:30 -0400 Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailnew.nyi.internal (Postfix) with ESMTP id 41A39581F53; Sun, 9 Apr 2023 12:33:24 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute5.internal (MEProxy); Sun, 09 Apr 2023 12:33:24 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gutov.dev; h=cc :cc:content-transfer-encoding:content-type:content-type:date :date:from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:sender:subject:subject:to:to; s=fm1; t= 1681058004; x=1681061604; bh=BecJ/4dupAC9GVsQhBS3Z2IxVeeAN90GPPq Wrq9JmDo=; b=dDCPGdwD1bRmIVHhrYj0Wy3NIZsKzd98pP4bgcin99QVnuyX5Xm HsL11/SNi+nULdE3yexsDGYg2wp5cARSzdFVtwpW4AlaCs90ptdcZGyTtSleShpw NEpQEObkgkOCjAxV6Qd/yPE3tBc9vW4CEqKcLkzbnolZeuk+IpwtSe5X9HRrp6vR aMdSASP9w06HmkX5e8uT57DD+Am4WOZSPNDaoL/oRfPb0yU4srq8mRUsRg3b6f/o o8qZbgJY7ATvnSU4ZHVWdKGBZud0ojZliL2wNRAjk2ceXVBtPHkdTrd0YRu05yLI jBWmkJ+2+ApIydA7g37UWv4p4ic9DDGCuug== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:sender:subject:subject:to:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm2; t= 1681058004; x=1681061604; bh=BecJ/4dupAC9GVsQhBS3Z2IxVeeAN90GPPq Wrq9JmDo=; b=Ov/8EmP6BYFxDmzzkOdvu33qq2dWdP2n3e2i0pjstemCwiYGiRW zckG6W3VEZy3AjHHtyDm62xg8zynln/Yj75zRZ06CCkh1ZSklatx3QnHJPTeNNZP kaO/HzkNvAHlMOex6Dr/tshSEntXzs3BHRNDB+vGZGbCcTvRsx/n4xmP2kbHB5Uu qfdtzwfLUe5KBsCLuU+pGn1Aiw+cctMtHKmTkQ00Fn0gjqWJysLehswNK1w2SfqY TfcwubWcM49mmR1fkBu+JTTM4ti0u4GL61dO/mNS9glPFSMxhkiLNhnIahOe8xMx zlia63yOHaoqOO0K8dKX2Bkn+Z1gLr0fleA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvhedrvdektddguddtgecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd enucfjughrpefkffggfgfuvfevfhfhjggtgfesthekredttdefjeenucfhrhhomhepffhm ihhtrhihucfiuhhtohhvuceoughmihhtrhihsehguhhtohhvrdguvghvqeenucggtffrrg htthgvrhhnpefhffehleejffegffeugefhkeektdffgfehjedvgeejtedtudehueffgffg feejheenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpe gumhhithhrhiesghhuthhovhdruggvvh X-ME-Proxy: Feedback-ID: i0e71465a:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Sun, 9 Apr 2023 12:33:21 -0400 (EDT) Message-ID: <9e796983-fdc2-1bb7-8c8d-e4ce5e347fa8@gutov.dev> Date: Sun, 9 Apr 2023 19:33:20 +0300 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.9.0 Content-Language: en-US References: <83a5zhmy3r.fsf@gnu.org> From: Dmitry Gutov In-Reply-To: <83a5zhmy3r.fsf@gnu.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Score: -1.1 (-) 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.1 (--) On 09/04/2023 08:19, Eli Zaretskii wrote: >> Cc: Theodor Thornhill, Yuan Fu, >> 62717@debbugs.gnu.org, >> João Távora, >> Alan Mackenzie >> Date: Sun, 9 Apr 2023 03:20:23 +0300 >> From: Dmitry Gutov >> >> What does this mean for us? Short of reimplementing nvim-treesitter's >> algorithm (and I haven't read Atom's or Zed's indentation code; >> anybody's welcome to chime in with a summary of either), we could just >> install the patch at the end of this message: it fixes this particular >> case, in a bit hackish way, but at least it doesn't affect other languages. >> >> Note that it still doesn't fix very similar cases, e.g. >> >> int main () { >> for (;;) { >> >> (we need additional rules looking for ERROR nodes, like in nvim's >> indent.scm), but in does fix >> >> int main () { >> for (;;) {} >> >> and >> >> int main () { >> int foo; >> >> I'm not sure, though, what is the big deal with adding the top-level >> function's closing curly first thing before writing the body (after that >> the parser starts working much better), so as far as I'm concerned this >> patch is very optional. It does add some complexity, after all. > If the patch solves some of the problems, passes the test suite, and > doesn't introduce any regressions you see, I think you should install > it (unless someone here objects). With this kind of change, it's hard to judge regression potential in advance. I don't really write C/C++ myself with any regularity. And our test suite doesn't really work incomplete parse trees, I think. So if we want this in emacs-29, I think someone interested should try running with this patch applied, at least for a little bit. Maybe just wait for a couple of days, if Daniel is testing it already. From unknown Sun Jun 15 08:53:36 2025 X-Loop: help-debbugs@gnu.org Subject: bug#62717: 29.0.60; c-ts-mode does not indent the first line in a function after RET Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 09 Apr 2023 17:37:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 62717 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Dmitry Gutov Cc: casouri@gmail.com, theo@thornhill.no, 62717@debbugs.gnu.org, mardani29@yahoo.es, joaotavora@gmail.com, acm@muc.de Received: via spool by 62717-submit@debbugs.gnu.org id=B62717.16810618086453 (code B ref 62717); Sun, 09 Apr 2023 17:37:01 +0000 Received: (at 62717) by debbugs.gnu.org; 9 Apr 2023 17:36:48 +0000 Received: from localhost ([127.0.0.1]:33595 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1plYy8-0001g0-8G for submit@debbugs.gnu.org; Sun, 09 Apr 2023 13:36:48 -0400 Received: from eggs.gnu.org ([209.51.188.92]:55614) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1plYy4-0001fl-R3 for 62717@debbugs.gnu.org; Sun, 09 Apr 2023 13:36:46 -0400 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 1plYxx-0001uU-VW; Sun, 09 Apr 2023 13:36:37 -0400 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=Q+zEA3OhtdPuB0QpfiCE7hLE7t9ABiFMWursGAZXm7I=; b=Co0C21DVajei KfuHZuFamrRxwGCJ+jgGMNvuLtEvKFRcCM4w6B3dy08zXr0EQJDOMiUZ5O1+WIszTlGYvBptucIEb yliHDPk1RQMhtuYW5YZu4JHVzxvQXCMvUHqSjItzgeIsHTHxa40duHX/ApHY6l0hrjrllRwi97+Oi bmtl2/nGg8qazjQTqrAnu7zYN7YpcV7bke+koSJ9iWunvYYAv9rhIim6L0sN7asBkntVTrCP6olIH 1IKuZBsgdWyobVklUW07y5gTqZ9J+Exf15np0dwiw0c2wjHOz8RfSQLdv14/u2yuwBx3EfiI8hyaK xmCNeUzK/Ad1dK228JGgnQ==; 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 1plYxx-00027P-7g; Sun, 09 Apr 2023 13:36:37 -0400 Date: Sun, 09 Apr 2023 20:37:14 +0300 Message-Id: <833559lzxx.fsf@gnu.org> From: Eli Zaretskii In-Reply-To: <9e796983-fdc2-1bb7-8c8d-e4ce5e347fa8@gutov.dev> (message from Dmitry Gutov on Sun, 9 Apr 2023 19:33:20 +0300) References: <83a5zhmy3r.fsf@gnu.org> <9e796983-fdc2-1bb7-8c8d-e4ce5e347fa8@gutov.dev> 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: Sun, 9 Apr 2023 19:33:20 +0300 > Cc: mardani29@yahoo.es, theo@thornhill.no, casouri@gmail.com, > 62717@debbugs.gnu.org, joaotavora@gmail.com, acm@muc.de > From: Dmitry Gutov > > > If the patch solves some of the problems, passes the test suite, and > > doesn't introduce any regressions you see, I think you should install > > it (unless someone here objects). > > With this kind of change, it's hard to judge regression potential in > advance. I don't really write C/C++ myself with any regularity. And our > test suite doesn't really work incomplete parse trees, I think. > > So if we want this in emacs-29, I think someone interested should try > running with this patch applied, at least for a little bit. Maybe just > wait for a couple of days, if Daniel is testing it already. The pretest will be out VSN. Maybe you should install this, and we can then back it out if people complain. FWIW, I intend to use only c-ts-mode when I the pretest is out, so if there are regressions, I think I will see it soon enough. From unknown Sun Jun 15 08:53:36 2025 X-Loop: help-debbugs@gnu.org Subject: bug#62717: 29.0.60; c-ts-mode does not indent the first line in a function after RET Resent-From: Dmitry Gutov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 10 Apr 2023 00:37:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 62717 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Eli Zaretskii Cc: casouri@gmail.com, theo@thornhill.no, 62717@debbugs.gnu.org, mardani29@yahoo.es, joaotavora@gmail.com, acm@muc.de Received: via spool by 62717-submit@debbugs.gnu.org id=B62717.168108700820569 (code B ref 62717); Mon, 10 Apr 2023 00:37:01 +0000 Received: (at 62717) by debbugs.gnu.org; 10 Apr 2023 00:36:48 +0000 Received: from localhost ([127.0.0.1]:33956 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1plfWZ-0005Lh-V1 for submit@debbugs.gnu.org; Sun, 09 Apr 2023 20:36:48 -0400 Received: from wnew1-smtp.messagingengine.com ([64.147.123.26]:43549) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1plfWY-0005LT-4p for 62717@debbugs.gnu.org; Sun, 09 Apr 2023 20:36:47 -0400 Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailnew.west.internal (Postfix) with ESMTP id E383E2B06722; Sun, 9 Apr 2023 20:36:39 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute5.internal (MEProxy); Sun, 09 Apr 2023 20:36:40 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gutov.dev; h=cc :cc:content-transfer-encoding:content-type:content-type:date :date:from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:sender:subject:subject:to:to; s=fm1; t= 1681086999; x=1681090599; bh=bN+cn3KKu1c4KVno1YfqER5xwve2d27KIbC S1S9ooPI=; b=ch0uvdyCb+6nfk37ycOOhFr7loYeJqTovNkOWgaQtTHY2EUOisY vFrfdTmZg8BZ1p6PpG56g6IL90dUnn0LE5dKSEtBdbl2f1/+FU03Bpi/x20XAt08 x/j52oU46kjiq2YcE63rWzuRRaLTO/qXcVSaFfBR9zHXRSA5HpNI/xVqKO2IfsI3 V5Aeb1m3J6WLSVyO2GERFezhXQMomjzZYXQ2+tWkjEKbpIHyOFGcB5WHMaduD9Um cPGJLNaztk3RHxhGg4t6hCFZHEhFvB73xfzhNSjp6oJaMQOFf9ygPLBsvlYmXZH5 XHn4bTqsnOssZ3BIH4SUm7yy9AgJ4h3QYeQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:sender:subject:subject:to:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm2; t= 1681086999; x=1681090599; bh=bN+cn3KKu1c4KVno1YfqER5xwve2d27KIbC S1S9ooPI=; b=cNfTzv3GaKdK8df0VwQN3fzuXk20Br2TmXgKmP9SSOdIN6Ck1lv mrpT0MIHIJcPJbUtu0m9AYxlUOjEARr2bs5QdEKhI9u+8zKmcUswFU96vPW1dwei zEh4LlRJQ8lP8HvagY6VfDn0zsLDoXxMUTHe5d575ZezpOQ4x2UDsmeVzPzrqPM6 /0q+JOhMeAkAzHqy09nIAuuclaL/EeYaT2XwQG/dYE/Py1KTKg7onZRn+JxfJiuY qZe/XPt6kUARKYpz5ZyLdVCYlFa83a3348dONkccCv+VYDGY0ZtQ+YbS3LkbzrT4 PV3gUY4EzZrCuNYgRnhxBWHOuJuXH2wR1lA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvhedrvdekuddgfeekucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepkfffgggfuffvvehfhfgjtgfgsehtjeertddtfeejnecuhfhrohhmpeffmhhi thhrhicuifhuthhovhcuoegumhhithhrhiesghhuthhovhdruggvvheqnecuggftrfgrth htvghrnhepiefgteevheevveffheeltdeukeeiieekueefgedugfefgefhudelgfefveel vdevnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepug hmihhtrhihsehguhhtohhvrdguvghv X-ME-Proxy: Feedback-ID: i0e71465a:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Sun, 9 Apr 2023 20:36:36 -0400 (EDT) Message-ID: <8a461864-23dc-66af-2f19-c812811330b6@gutov.dev> Date: Mon, 10 Apr 2023 03:36:35 +0300 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.9.0 Content-Language: en-US References: <83a5zhmy3r.fsf@gnu.org> <9e796983-fdc2-1bb7-8c8d-e4ce5e347fa8@gutov.dev> <833559lzxx.fsf@gnu.org> From: Dmitry Gutov In-Reply-To: <833559lzxx.fsf@gnu.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Score: -1.1 (-) 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.1 (--) On 09/04/2023 20:37, Eli Zaretskii wrote: >> Date: Sun, 9 Apr 2023 19:33:20 +0300 >> Cc:mardani29@yahoo.es,theo@thornhill.no,casouri@gmail.com, >> 62717@debbugs.gnu.org,joaotavora@gmail.com,acm@muc.de >> From: Dmitry Gutov >> >>> If the patch solves some of the problems, passes the test suite, and >>> doesn't introduce any regressions you see, I think you should install >>> it (unless someone here objects). >> With this kind of change, it's hard to judge regression potential in >> advance. I don't really write C/C++ myself with any regularity. And our >> test suite doesn't really work incomplete parse trees, I think. >> >> So if we want this in emacs-29, I think someone interested should try >> running with this patch applied, at least for a little bit. Maybe just >> wait for a couple of days, if Daniel is testing it already. > The pretest will be out VSN. Maybe you should install this, and we > can then back it out if people complain. FWIW, I intend to use only > c-ts-mode when I the pretest is out, so if there are regressions, I > think I will see it soon enough. Okay, SGTM. I've pushed the patch to emacs-29. Note that there remains a bunch of more complex cases that don't indent well while there are no closing braces in the buffer. Examples: int main() { for (;;) { (including every variation where some chars are deleted from the end of the second line), or int main() { if (2 == 2) or int main() { if (2 == 2) foo(); else etc. Enumerating every such case to create a special indentation logic seems a little tiring. Though if 2-3 of them are determined to be the most important ones, that might be doable. But again, as long as there is at least one '}' after point, though, indentation in all of these cases improves. Though perhaps not ideally sometimes (e.g. for parenless if/else clauses the indentation starts out without the additional level). Anyway, the case described in the report should now be working. Whether to close the bug or not, it's up to you and other interested parties. From unknown Sun Jun 15 08:53:36 2025 X-Loop: help-debbugs@gnu.org Subject: bug#62717: 29.0.60; c-ts-mode does not indent the first line in a function after RET Resent-From: Yuan Fu Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 10 Apr 2023 21:05:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 62717 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Dmitry Gutov Cc: theodor thornhill , 62717@debbugs.gnu.org, Daniel =?UTF-8?Q?Mart=C3=ADn?= , =?UTF-8?Q?Jo=C3=A3o_?= =?UTF-8?Q?T=C3=A1vora?= , acm@muc.de, Eli Zaretskii Received: via spool by 62717-submit@debbugs.gnu.org id=B62717.168116069421213 (code B ref 62717); Mon, 10 Apr 2023 21:05:02 +0000 Received: (at 62717) by debbugs.gnu.org; 10 Apr 2023 21:04:54 +0000 Received: from localhost ([127.0.0.1]:36050 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1plyh4-0005W5-76 for submit@debbugs.gnu.org; Mon, 10 Apr 2023 17:04:54 -0400 Received: from mail-pj1-f45.google.com ([209.85.216.45]:45792) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1plyh2-0005Vs-EV for 62717@debbugs.gnu.org; Mon, 10 Apr 2023 17:04:53 -0400 Received: by mail-pj1-f45.google.com with SMTP id e18-20020a17090ac21200b00246952d917fso4260053pjt.4 for <62717@debbugs.gnu.org>; Mon, 10 Apr 2023 14:04:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1681160686; 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=7saZpe5N68K9KuCXLhGtN3NozZu5MXoj4WfQl22sWyg=; b=HIW2fENsBYzUpPttTudm2eQZydEnPCp1v6o8HUe3XfMPNZsriTs1fA+awBf+OJhXUm +ptsvxi0TgPjjeQHeOdmyStwRTvCfPt0BxJ3mF0ug4QR6f6pN7QPepllucWyaYU4mx5D ecGuZPdSfX892va+5NwG1Ugud2jiJldKLKlcnOUcvkAXIMHUY+0LwzUIddldojuJlt9g YBKK6T09VEfIFGAyhEiwZDKxxJPq/C3TgTt0aDYZCw+/psv3HH8k4uqgapvW/bDzO4AW ec7qcMf+Kj2d3+J0uCRpMQCsHktUpCtf6/6KWl7VfDw6MOy3p27fOvQvcczIbcue62aD nz5A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1681160686; 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=7saZpe5N68K9KuCXLhGtN3NozZu5MXoj4WfQl22sWyg=; b=nxyUnlGgNutxyffSThacva+bZXGd0g8R3qdB+Tyc9A+k084nVF5Vzpx+exP4KG8L6E eqqeq4yIdA/rF9QbgWEYg9cENkz2ZbMxuzJ93VuB5jrjxhbhTZx2vBv/WHUvIuvb13+L svJotNOgSq4qKgB74l7cF7AQprin+ordQdqQ6WcnBNNeq5hweAoiW3fp/Y5MRChUHtFL 4u65+6qeecVCYhrj1QhbY7MFLyzXK5EQfVWq7+HPoQCQglOhG09QM/vpNo2OFkEa5t+/ MplVeeZwll/9sUmLq2chy/O3DI4TwDBROyfKFzqXKjQQih7Dun6k6vEoLQFX5axtckUc X9Kg== X-Gm-Message-State: AAQBX9cbbKd0xWSuh+vS0dSaWZFPVpRd3xPmJfu+zzjblWNmNHT0dW81 sVTR7jyDCTbsz0h3BTngFMM= X-Google-Smtp-Source: AKy350ZAFNF3hE7YUJAdb3CfTgkKxoRzQ9IM4D2r2auq8/QT3ZgeKZuC5XPfgicbQxw58IeR2898Og== X-Received: by 2002:a05:6a20:8f02:b0:e9:14e9:46ee with SMTP id b2-20020a056a208f0200b000e914e946eemr11832839pzk.28.1681160686056; Mon, 10 Apr 2023 14:04:46 -0700 (PDT) Received: from smtpclient.apple (cpe-172-117-161-177.socal.res.rr.com. [172.117.161.177]) by smtp.gmail.com with ESMTPSA id f9-20020a63de09000000b00502e6bfedc0sm7430599pgg.0.2023.04.10.14.04.44 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 10 Apr 2023 14:04:45 -0700 (PDT) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3731.500.231\)) From: Yuan Fu In-Reply-To: <8a461864-23dc-66af-2f19-c812811330b6@gutov.dev> Date: Mon, 10 Apr 2023 14:04:33 -0700 Content-Transfer-Encoding: quoted-printable Message-Id: References: <83a5zhmy3r.fsf@gnu.org> <9e796983-fdc2-1bb7-8c8d-e4ce5e347fa8@gutov.dev> <833559lzxx.fsf@gnu.org> <8a461864-23dc-66af-2f19-c812811330b6@gutov.dev> X-Mailer: Apple Mail (2.3731.500.231) 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 (-) > On Apr 9, 2023, at 5:36 PM, Dmitry Gutov wrote: >=20 > On 09/04/2023 20:37, Eli Zaretskii wrote: >>> Date: Sun, 9 Apr 2023 19:33:20 +0300 >>> Cc:mardani29@yahoo.es,theo@thornhill.no,casouri@gmail.com, >>> 62717@debbugs.gnu.org,joaotavora@gmail.com,acm@muc.de >>> From: Dmitry Gutov >>>=20 >>>> If the patch solves some of the problems, passes the test suite, = and >>>> doesn't introduce any regressions you see, I think you should = install >>>> it (unless someone here objects). >>> With this kind of change, it's hard to judge regression potential in >>> advance. I don't really write C/C++ myself with any regularity. And = our >>> test suite doesn't really work incomplete parse trees, I think. >>>=20 >>> So if we want this in emacs-29, I think someone interested should = try >>> running with this patch applied, at least for a little bit. Maybe = just >>> wait for a couple of days, if Daniel is testing it already. >> The pretest will be out VSN. Maybe you should install this, and we >> can then back it out if people complain. FWIW, I intend to use only >> c-ts-mode when I the pretest is out, so if there are regressions, I >> think I will see it soon enough. >=20 > Okay, SGTM. I've pushed the patch to emacs-29. >=20 > Note that there remains a bunch of more complex cases that don't = indent well while there are no closing braces in the buffer. >=20 > Examples: >=20 > int main() { > for (;;) { >=20 > (including every variation where some chars are deleted from the end = of the second line), or >=20 > int main() { > if (2 =3D=3D 2) >=20 > or >=20 > int main() { > if (2 =3D=3D 2) > foo(); > else >=20 > etc. >=20 > Enumerating every such case to create a special indentation logic = seems a little tiring. Though if 2-3 of them are determined to be the = most important ones, that might be doable. >=20 > But again, as long as there is at least one '}' after point, though, = indentation in all of these cases improves. Though perhaps not ideally = sometimes (e.g. for parenless if/else clauses the indentation starts out = without the additional level). >=20 > Anyway, the case described in the report should now be working. = Whether to close the bug or not, it's up to you and other interested = parties. Thanks for working on this. Maybe we can incorporate the indent.scm = method by adding another indent engine alongside the current = =E2=80=9Csimple-indent=E2=80=9D.=20 Yuan=