From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#67417: 29.1.50; c-ts-mode syntax issues with no brackets Date: Tue, 28 Nov 2023 16:27:37 +0200 Message-ID: <83cyvu7y1y.fsf@gnu.org> References: <83h6lbfwcu.fsf@gnu.org> <2ba91823-bf3c-4d5d-e556-1622135ab2fd@gutov.dev> <8f8aa9c5-95cb-44e5-b41e-4cf58f024624@gmail.com> <33b587b2-1ea1-f756-704f-e75a3193c147@gutov.dev> <720463fd-c6d8-4c31-8240-7017984084a4@gmail.com> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="22507"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 67417@debbugs.gnu.org, dmitry@gutov.dev, arteen@linux.ucla.edu To: Yuan Fu Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Tue Nov 28 15:29: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 1r7z5I-0005bi-2N for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 28 Nov 2023 15:29:08 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1r7z56-0004TH-Jw; Tue, 28 Nov 2023 09:28:56 -0500 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 1r7z55-0004Sz-Kb for bug-gnu-emacs@gnu.org; Tue, 28 Nov 2023 09:28:55 -0500 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 1r7z55-0002Qb-Cm for bug-gnu-emacs@gnu.org; Tue, 28 Nov 2023 09:28:55 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1r7z5B-0002QW-Q2 for bug-gnu-emacs@gnu.org; Tue, 28 Nov 2023 09:29:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 28 Nov 2023 14:29:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 67417 X-GNU-PR-Package: emacs Original-Received: via spool by 67417-submit@debbugs.gnu.org id=B67417.17011816899236 (code B ref 67417); Tue, 28 Nov 2023 14:29:01 +0000 Original-Received: (at 67417) by debbugs.gnu.org; 28 Nov 2023 14:28:09 +0000 Original-Received: from localhost ([127.0.0.1]:45875 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1r7z4K-0002Ot-7h for submit@debbugs.gnu.org; Tue, 28 Nov 2023 09:28:08 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:44928) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1r7z4F-0002OV-Ir for 67417@debbugs.gnu.org; Tue, 28 Nov 2023 09:28:06 -0500 Original-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 1r7z42-0002Io-KL; Tue, 28 Nov 2023 09:27:50 -0500 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=i8+85OAtXH73Zxj6zf9/KvFHTNsxgD7zP79ZGEDzzsw=; b=RAObwKNWjmw+ 1HgJOngoy6G4Qe+DYIwizzIDQ1vOJEIyk4EEYQC+4/bXm7F6ajmdH9/m8eCBE2Zc+K3gl5z+HeYq9 B2tAajS3xuJGbv8U9IhsZlaJc3joYSNDoaVXmwrII1WgQ+gJ+81ziarMTpLFxYMMVWB9iicVS0SDO IV6lp7vAZDNywvMkZzSffPFBhzDa0LcnK+uVQtX6m8n6Dti7CZ6qhPUnjmTpFInlJteBhwsRhBfy+ BSkdYM7ygjq5jUbkFy5GeHWY9o/fhsRg5GYEVEVC7IauEmYYRycY5V58x3j7jHelQCuBH1Kh3uicv Aeb6gV5kC/JD+5p7vJi9eg==; In-Reply-To: <720463fd-c6d8-4c31-8240-7017984084a4@gmail.com> (message from Yuan Fu on Mon, 27 Nov 2023 22:55:31 -0800) 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:275164 Archived-At: > Date: Mon, 27 Nov 2023 22:55:31 -0800 > Cc: 67417@debbugs.gnu.org > From: Yuan Fu > > > > On 11/26/23 6:22 PM, Dmitry Gutov wrote: > > On 27/11/2023 03:47, Yuan Fu wrote: > >> I pushed two commits which should fix the indentation for "break" > >> after "else", and indentation for empty lines after if/else/for/while > >> in general. The fix for the general case doesn't use the parse tree, > >> since the parse tree is often incomplete when you type if (...) and > >> hit return. Instead it uses a plain regexp match to see if the > >> previous line starts with if/else/for/while. This seems like a > >> reasonable heuristic to use before user types more things, at which > >> point more accurate indentation rules would be used, since the parse > >> tree should be more complete then. > > > > Sorry, two counter-examples right away: > > > > Type 'elsewhere();' and RET -> the next line is indented 1 level > > extra, at least until you type some more and then have the line > > reindented either with pressing TAB or adding semicolon. > > > > Type 'for (;;) {}' and RET -> same. > > > > The first case is easy to guard against (just check that the next char > > is either space of opening paren), but the second one less so. OTOH, > > the second case is likely to have a parse tree without errors, so if > > we also check for that... the heuristic might work. > > Well, darn it. And you're right, the second case is a bit hard to > check... Well I guess for the moment we can remove this heuristic. (I > tried a bit, and checking for no errors is not so easy.) Does this mean you need to revert something on the emacs-29 branch?