From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Yuan Fu Newsgroups: gmane.emacs.bugs Subject: bug#62412: 29.0.60; strange c++ indentation behavior with tree sitter Date: Fri, 24 Mar 2023 11:17:28 -0700 Message-ID: <2496F2A0-3EB1-4CD2-B299-E1DC41B7C23B@gmail.com> References: <41859726-8f6d-c8d9-5a56-b0c98c153391@gmail.com> Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3731.400.51.1.1\)) 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="29783"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 62412@debbugs.gnu.org, theodor thornhill To: 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:04:33 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 1pfpWS-0007Se-Ot for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 24 Mar 2023 23:04:32 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pfpTF-00045Y-Gv; Fri, 24 Mar 2023 18:01:13 -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 1pfpTB-00040j-St for bug-gnu-emacs@gnu.org; Fri, 24 Mar 2023 18:01:10 -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 1pfpTB-0000eY-IN for bug-gnu-emacs@gnu.org; Fri, 24 Mar 2023 18:01:09 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1pflzG-00012L-3d for bug-gnu-emacs@gnu.org; Fri, 24 Mar 2023 14:18:02 -0400 X-Loop: help-debbugs@gnu.org In-Reply-To: <41859726-8f6d-c8d9-5a56-b0c98c153391@gmail.com> Resent-From: Yuan Fu Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 24 Mar 2023 18:18:02 +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.16796818703949 (code B ref 62412); Fri, 24 Mar 2023 18:18:02 +0000 Original-Received: (at 62412) by debbugs.gnu.org; 24 Mar 2023 18:17:50 +0000 Original-Received: from localhost ([127.0.0.1]:41334 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pflz4-00011d-04 for submit@debbugs.gnu.org; Fri, 24 Mar 2023 14:17:50 -0400 Original-Received: from mail-pl1-f175.google.com ([209.85.214.175]:46911) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pflz2-00011N-EO for 62412@debbugs.gnu.org; Fri, 24 Mar 2023 14:17:49 -0400 Original-Received: by mail-pl1-f175.google.com with SMTP id kq3so2559716plb.13 for <62412@debbugs.gnu.org>; Fri, 24 Mar 2023 11:17:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1679681862; h=to:cc:date:message-id:subject:mime-version :content-transfer-encoding:from:from:to:cc:subject:date:message-id :reply-to; bh=FcabfB+2wP/Qq/Jngi3CRs2jl5u4f1Hy0BVZcr93d4U=; b=muom3fN6tklbv8OSGHilIPh7VgVAk8BjmujAQ2OsMy+It5gkM3Zu2bXYeVAWY1b4Cd T4fkjDjEeicxwA9aQ+n+WohEd+d6OzSEABi7otlgc2sUH1KMlKAD2Ie/2T2wysy7yGwi xp57MP5UsXf+e1kLK5RTQzEHA7NvBvDGDVozA+hMtFIT8C0kJny9uD+SdZUxY5KbRBRw 4SR3Cr0LOPQ3Kx0Yn8Y908RliP2ePk/j7uXmsVSH91dyuhj9QDZN+Qgei6GYXvqNwPk7 R+N/xYFN/XN3Ko2r+YA1o9uUYGlpYGrF9ROWMdasNhfsW4G/2+LUnaZGjvmbRqgX7Qqb G1DA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1679681862; h=to:cc:date:message-id:subject:mime-version :content-transfer-encoding:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=FcabfB+2wP/Qq/Jngi3CRs2jl5u4f1Hy0BVZcr93d4U=; b=fkmOgLF4mabLs+r34hmiE34OiQxj6xE1FJ2fS1NVwyORFxp2lz8yLAA0UMO4s5BQQl UtGU/NT5eYAkl1lMbVsYbqzSUaNrVPmluZ2VsnicjbiaeI3D+YOdCZwVeUAnwmdNbe6B bCqqb9GGGhGn4rwEV++6AfpxRe3wrP7POvsxjOGzPsWFg4JA0/a3bJ7ctYpPQECYpK2C j38TNDrKY2hPjvmk7uNPHqVwPedLELIChCx4gITaWHWQnFFh38G2d2WyBaBRFdZfIhmH SSBDLYeJrpwkAMa1xGNO/U7MdI3zLO3IKLoHfzQjp2kiyCMv9DeX8nbjcfQ2hfq90nvh uDzA== X-Gm-Message-State: AAQBX9ey4lXhozd0Y5ZrwEicJjiPI9cjlqNYEu/2tAcaNJF/DmGETsL8 Hw0Fy68ssl0v8GkjlbieEMs= X-Google-Smtp-Source: AKy350YFOaUAAtcAnDohkF5xGLqQxVt+VMnHdLtjXRAyIHT87OpSEUuPH5YyWpElun5x74wGrYMtoA== X-Received: by 2002:a17:90a:e7cf:b0:23c:8ee2:bc14 with SMTP id kb15-20020a17090ae7cf00b0023c8ee2bc14mr4477949pjb.24.1679681862285; Fri, 24 Mar 2023 11:17:42 -0700 (PDT) Original-Received: from smtpclient.apple (cpe-172-117-161-177.socal.res.rr.com. [172.117.161.177]) by smtp.gmail.com with ESMTPSA id g4-20020a17090adb0400b0023f8bdc4a7fsm217495pjv.14.2023.03.24.11.17.41 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Fri, 24 Mar 2023 11:17:41 -0700 (PDT) X-Mailer: Apple Mail (2.3731.400.51.1.1) 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:258523 Archived-At: "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). Notice that the line will > lose its indentation ("for" will be moved to column 1). 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). > > This doesn't happen if the main function is deleted. 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. 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=99= ing Theo. Yuan