Received: (at 62717) by debbugs.gnu.org; 8 Apr 2023 07:16:25 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Sat Apr 08 03:16:25 2023 Received: from localhost ([127.0.0.1]:57577 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1pl2oC-000894-Um for submit <at> 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 <dmitry@HIDDEN>) id 1pkxq7-0007Or-LJ for 62717 <at> 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: <xms:JMowZOHK78Kx567sQHYh_uagY1szXWKINzGnhOiidCNI5H4iL2zdAQ> <xme:JMowZPWjwd3Du_lnEeBnElUa8n3oXU35jMN2pfjjZpDHYpcOoJEDKJe4mIzMpDxQi oD_Ss3lFAkkZ0xmxL0> X-ME-Received: <xmr:JMowZIJF_fdmgfOa0S5P1gyBtvMhvwd9IpX6Wc2GMyZGyJwk9FVKl6xNH-GFyiE> X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvhedrvdejiedghedtucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepkfffgggfuffvfhevhfgjtgfgsehtkeertddtfeejnecuhfhrohhmpeffmhhi thhrhicuifhuthhovhcuoegumhhithhrhiesghhuthhovhdruggvvheqnecuggftrfgrth htvghrnhepfeeiueehvdfguefguefhlefgkeejudevteelgedvgfeftedtudevjeefudel udfhnecuffhomhgrihhnpehgihhthhhusgdrtghomhenucevlhhushhtvghrufhiiigvpe dtnecurfgrrhgrmhepmhgrihhlfhhrohhmpegumhhithhrhiesghhuthhovhdruggvvh X-ME-Proxy: <xmx:JMowZIHQBDhnMGiCo9N7C6p3yhE_ItgnF0i7f3jCoew5DpK1NktZLQ> <xmx:JMowZEVxkH4hBivXX3RICE4O0d3GCHdAkKxEGuVF9h0uKAUa4Dm-yQ> <xmx:JMowZLPUxmsSW2rRxwdfvrsB5qEKPO9-hrnaJrhd2IzQ1LVGekWdLg> <xmx:JcowZBiCvP2lrVFzsVtcIvS9SPGFaovIQrDpBvDjBFqOo6_L2TQVLj7bvBs> Feedback-ID: i0e71465a:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Fri, 7 Apr 2023 21:57:55 -0400 (EDT) Message-ID: <ab20b112-057f-4dcd-268f-4095180fad2a@HIDDEN> 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 Subject: Re: bug#62717: 29.0.60; c-ts-mode does not indent the first line in a function after RET Content-Language: en-US To: =?UTF-8?Q?Daniel_Mart=c3=adn?= <mardani29@HIDDEN>, 62717 <at> debbugs.gnu.org References: <m1355ba2xr.fsf.ref@HIDDEN> <m1355ba2xr.fsf@HIDDEN> From: Dmitry Gutov <dmitry@HIDDEN> In-Reply-To: <m1355ba2xr.fsf@HIDDEN> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Score: -1.1 (-) X-Debbugs-Envelope-To: 62717 X-Mailman-Approved-At: Sat, 08 Apr 2023 03:16:22 -0400 Cc: Yuan Fu <casouri@HIDDEN>, Theodor Thornhill <theo@HIDDEN> X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> 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?
bug-gnu-emacs@HIDDEN
:bug#62717
; Package emacs
.
Full text available.Received: (at submit) by debbugs.gnu.org; 7 Apr 2023 19:49:09 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Fri Apr 07 15:49:09 2023 Received: from localhost ([127.0.0.1]:57269 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1pks57-0005or-FR for submit <at> 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 <mardani29@HIDDEN>) id 1pks56-0005ok-Dj for submit <at> 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 <mardani29@HIDDEN>) id 1pks50-0002eP-Go for bug-gnu-emacs@HIDDEN; 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 <mardani29@HIDDEN>) id 1pks4y-0000NO-Fv for bug-gnu-emacs@HIDDEN; 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.1UDn5P4Bsef_kl3ic9teEfquDBKce9AQgNxScrrsGLAtRipj_3eFElzh9P mbwC3YinwjuQFnC6pog0yRnK9xyGtIpCRO6SfmwLBudJ.wXDf1eqFzBf6t2yCDYOuE8qoV82DzLh tZR062t0PrvkJq0zNoqcuEssAHCtRmhIBYkcIKGbkyNNKmiL0rBNpVwDiv1CONjnQoNdoykyFUjt E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jcOt7uFDmuctdzYdz6vtgLdjMEtTf1TTM7bOzB2dIIPtLxtE9VMv_edcwB5kOEZxwka.M_ 5BRxl8i_SaHT9L83YI0wKFj0MMthEdSsw5z9T0HLJnTFx0HjXq2cz8FFdPm2C3a4UA3KMk0qLtbs 7DY5kDyedqwFNdFoev_OG8iUHIcdyJjpk2M8GGOszAoRGBOP_FaLaCYGF79uzyitALEyeYRuo5wh ff83WKrfkdN2zLC3vv9shHke._l7hPiq435xjWdjYl1E0AGv3D1J_bKg_TR00RI8g7bfx5X_7NE7 5N_cayMTn33B9RUpZF2YDb0OVMRxCbJj5xhaTrE3MqKsueeyoYnUhEGtbjVVme0HFNQ0cacmj7R5 _Q8Vbifdbg0qJ.R0ucvafY2SvaCvCiQxxnJTFG6aou6nS5SjaNLlwOobYXC68QSV4.j9Y.cdTSr0 xRvwDoQFFwAmuYmm7jirLl0PZZmvNpWNuWQ2uZFxcRr6tRH9xOoSICYjvaogG9X5lM.jGW3Kmp1b ROM8FNVQ.vuWPSCgOvcn3TUCfvU8p51._AQifno41AveLkkBh4D.9EVABXEW995h5jHXZYfwOqy5 fnjsCwKTKV4MR0A_iU6NwJuz5F0k7DWnPlzhqjy7rnu2YROYVaCJIop28brkAcHpn0TsQ4A.e7ph mVUEl9MK2QCFnDEVA_yOKb4YCqP6yDcF.1N92fSilUY6QkxyeIAVxNeE.2LdKxOC.D.BwUEHufDX t87qJ3FIe0hRmgR8CCI0nfYVhRtR_Acj5FC7ftmGww4yo6kSB4pMsEu_cnXyfF5uOsm_C7epouZS KS1gEWKkvi6QhAS36e7.ke8TezLk- X-Sonic-MF: <mardani29@HIDDEN> X-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: =?utf-8?Q?Daniel_Mart=C3=ADn?= <mardani29@HIDDEN> To: bug-gnu-emacs@HIDDEN Subject: 29.0.60; c-ts-mode does not indent the first line in a function after RET Date: Fri, 07 Apr 2023 21:48:48 +0200 Message-ID: <m1355ba2xr.fsf@HIDDEN> MIME-Version: 1.0 Content-Type: text/plain References: <m1355ba2xr.fsf.ref@HIDDEN> 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@HIDDEN; 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-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> 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.
Daniel Martín <mardani29@HIDDEN>
:bug-gnu-emacs@HIDDEN
.
Full text available.bug-gnu-emacs@HIDDEN
:bug#62717
; Package emacs
.
Full text available.
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997 nCipher Corporation Ltd,
1994-97 Ian Jackson.