From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Theodor Thornhill via "Bug reports for GNU Emacs, the Swiss army knife of text editors" Newsgroups: gmane.emacs.bugs Subject: bug#62412: 29.0.60; strange c++ indentation behavior with tree sitter Date: Fri, 24 Mar 2023 21:04:24 +0100 Message-ID: <46A6C705-97DA-4D17-999B-0536F01EFCA7@thornhill.no> References: <2496F2A0-3EB1-4CD2-B299-E1DC41B7C23B@gmail.com> Reply-To: Theodor Thornhill Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="13483"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 62412@debbugs.gnu.org To: Yuan Fu , geza.herman@gmail.com Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Fri Mar 24 23:02:11 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 1pfpUA-00039d-Qu for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 24 Mar 2023 23:02:11 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pfpTB-0003zW-5L; Fri, 24 Mar 2023 18:01:09 -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 1pfpT8-0003x6-6j for bug-gnu-emacs@gnu.org; Fri, 24 Mar 2023 18:01:06 -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 1pfpT7-0000eY-TC for bug-gnu-emacs@gnu.org; Fri, 24 Mar 2023 18:01:05 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1pfnen-00042q-S9 for bug-gnu-emacs@gnu.org; Fri, 24 Mar 2023 16:05:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Theodor Thornhill Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 24 Mar 2023 20:05:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 62412 X-GNU-PR-Package: emacs Original-Received: via spool by 62412-submit@debbugs.gnu.org id=B62412.167968827915517 (code B ref 62412); Fri, 24 Mar 2023 20:05:01 +0000 Original-Received: (at 62412) by debbugs.gnu.org; 24 Mar 2023 20:04:39 +0000 Original-Received: from localhost ([127.0.0.1]:41421 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pfneQ-00042D-KW for submit@debbugs.gnu.org; Fri, 24 Mar 2023 16:04:38 -0400 Original-Received: from out-43.mta1.migadu.com ([95.215.58.43]:13607) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pfneK-000420-8q for 62412@debbugs.gnu.org; Fri, 24 Mar 2023 16:04:36 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=thornhill.no; s=key1; t=1679688268; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=csgAqGWlhp0P6s6n1oepWNQVg1X1T4N9cLNQBjjRruA=; b=p6HEBiqqcOp1Y3UJHMGRbN6s8fohymwm1KYLpR5VMxtFtxE3IPBCRs2twopg848QvbTSDA mQqotsgbLFTOkGKIOzSbfCaQjQ8ZWQoJUOHMlOugaJuKoxqsmg/5zmCfaXevLnxtPG/m50 JyizRw7XmS/uYfbMXFVComGqOvKb7Y3OF44XVJfpog8tHisTJxNOIAQkeDU4t8Nzj7PWwT 461UXBySqCc9aBYRia1SFXBCl4grrYowHwnRSs7yG7/jp3qq6wwFQweYt1Ve/+fvV9DROr WGizRzjaIKl3y76HuXlugZ+GWnO1dlwZZ3L/UiOrRETfyZyvkyhwcQxKjFRbCw== X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. In-Reply-To: <2496F2A0-3EB1-4CD2-B299-E1DC41B7C23B@gmail.com> X-Migadu-Flow: FLOW_OUT 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:258511 Archived-At: On 24 March 2023 19:17:28 CET, Yuan Fu wrote: > >"Herman, Geza" writes: > >> Copy this half-written program to a c++-ts-mode buffer: >> >> ----- 8< ----------------------- >> >> void foo() { >> for (int i=3D0 >> } >> >> int main(int argc, char *argv[]) { >> } >> >> ----- 8< ----------------------- >> >> Move the point to the end of the line of the for loop, and press ";" >> (as if you continued to write the loop)=2E Notice that the line will >> lose its indentation ("for" will be moved to column 1)=2E If you >> continue writing the for loop, it will be correctly re-indented after >> the closing parenthesis (for example, continue the line with "; i<10; >> i++)", and notice that after pressing ")", the line will be >> re-indented)=2E >> >> This doesn't happen if the main function is deleted=2E I'm not sure >> whether this is a tree-sitter or emacs problem, but I reported here >> because I think it's more likely that this is some emacs problem=2E > >I believe this is due to this rule: > >((query "(ERROR (ERROR)) @indent") column-0 0) > >I=E2=80=99m not sure about the original purpose for this rule, CC=E2=80= =99ing Theo=2E > >Yuan I'll look more deeply into the cause of this, but the rule is covering som= e preproc directives iirc=2E Unfortunately tree-sitter behaves better when auto pairs is used=2E I woul= d advise people to use electric-pairs-mode (if that's the correct name, on = mobile now) to avoid these sorts of issues=2E=20 Theo