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: Mon, 10 Apr 2023 03:36:35 +0300 Message-ID: <8a461864-23dc-66af-2f19-c812811330b6@gutov.dev> References: <83a5zhmy3r.fsf@gnu.org> <9e796983-fdc2-1bb7-8c8d-e4ce5e347fa8@gutov.dev> <833559lzxx.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="16557"; 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 Mon Apr 10 02:37:24 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 1plfX8-00045F-IR for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 10 Apr 2023 02:37:23 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1plfWr-00047Y-4u; Sun, 09 Apr 2023 20:37:05 -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 1plfWp-00047K-Fd for bug-gnu-emacs@gnu.org; Sun, 09 Apr 2023 20:37:03 -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 1plfWo-0008FK-Nb for bug-gnu-emacs@gnu.org; Sun, 09 Apr 2023 20:37:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1plfWo-0005MH-1O for bug-gnu-emacs@gnu.org; Sun, 09 Apr 2023 20:37:02 -0400 X-Loop: help-debbugs@gnu.org 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 Original-Received: via spool by 62717-submit@debbugs.gnu.org id=B62717.168108700820569 (code B ref 62717); Mon, 10 Apr 2023 00:37:01 +0000 Original-Received: (at 62717) by debbugs.gnu.org; 10 Apr 2023 00:36:48 +0000 Original-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 Original-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 Original-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) Original-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 Original-Received: by mail.messagingengine.com (Postfix) with ESMTPA; Sun, 9 Apr 2023 20:36:36 -0400 (EDT) Content-Language: en-US In-Reply-To: <833559lzxx.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:259544 Archived-At: 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.