From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Dmitry Gutov Newsgroups: gmane.emacs.bugs Subject: bug#62717: 29.0.60; c-ts-mode does not indent the first line in a function after RET Date: Sun, 9 Apr 2023 19:33:20 +0300 Message-ID: <9e796983-fdc2-1bb7-8c8d-e4ce5e347fa8@gutov.dev> References: <83a5zhmy3r.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="29092"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.9.0 Cc: casouri@gmail.com, theo@thornhill.no, 62717@debbugs.gnu.org, mardani29@yahoo.es, joaotavora@gmail.com, acm@muc.de To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Apr 09 18:34:09 2023 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1plXzT-0007Id-J6 for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 09 Apr 2023 18:34:08 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1plXzP-0000u8-FG; Sun, 09 Apr 2023 12:34:03 -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 1plXzO-0000tn-Ba for bug-gnu-emacs@gnu.org; Sun, 09 Apr 2023 12:34:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1plXzO-0007wG-30 for bug-gnu-emacs@gnu.org; Sun, 09 Apr 2023 12:34:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1plXzN-0008Hf-VC for bug-gnu-emacs@gnu.org; Sun, 09 Apr 2023 12:34:01 -0400 X-Loop: help-debbugs@gnu.org 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 Original-Received: via spool by 62717-submit@debbugs.gnu.org id=B62717.168105801131800 (code B ref 62717); Sun, 09 Apr 2023 16:34:01 +0000 Original-Received: (at 62717) by debbugs.gnu.org; 9 Apr 2023 16:33:31 +0000 Original-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 Original-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 Original-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) Original-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 Original-Received: by mail.messagingengine.com (Postfix) with ESMTPA; Sun, 9 Apr 2023 12:33:21 -0400 (EDT) Content-Language: en-US In-Reply-To: <83a5zhmy3r.fsf@gnu.org> 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:259527 Archived-At: 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.