From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: =?UTF-8?Q?Jo=C3=A3o_?= =?UTF-8?Q?T=C3=A1vora?= Newsgroups: gmane.emacs.bugs Subject: bug#62412: 29.0.60; strange c++ indentation behavior with tree sitter Date: Sat, 25 Mar 2023 16:23:35 +0000 Message-ID: <87o7ogx0jc.fsf@gmail.com> References: <2496F2A0-3EB1-4CD2-B299-E1DC41B7C23B@gmail.com> <46A6C705-97DA-4D17-999B-0536F01EFCA7@thornhill.no> <72d72cd6-4fa8-2df3-f45d-5bf5845e4f38@gmail.com> 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="6274"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: Yuan Fu , Theodor Thornhill , 62412@debbugs.gnu.org To: Herman@debbugs.gnu.org, =?UTF-8?Q?G=C3=A9za?= Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Mar 25 17:37:27 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 1pg6tS-0001Pj-MI for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 25 Mar 2023 17:37:26 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pg6tG-0001Il-6V; Sat, 25 Mar 2023 12:37:14 -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 1pg6t9-0001Gk-Ef for bug-gnu-emacs@gnu.org; Sat, 25 Mar 2023 12:37:07 -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 1pg6t9-0000Lo-5e for bug-gnu-emacs@gnu.org; Sat, 25 Mar 2023 12:37:07 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1pg6eY-0003JZ-9d for bug-gnu-emacs@gnu.org; Sat, 25 Mar 2023 12:22:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: =?UTF-8?Q?Jo=C3=A3o_?= =?UTF-8?Q?T=C3=A1vora?= Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 25 Mar 2023 16:22: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.167976130112704 (code B ref 62412); Sat, 25 Mar 2023 16:22:02 +0000 Original-Received: (at 62412) by debbugs.gnu.org; 25 Mar 2023 16:21:41 +0000 Original-Received: from localhost ([127.0.0.1]:43320 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pg6eD-0003Ip-82 for submit@debbugs.gnu.org; Sat, 25 Mar 2023 12:21:41 -0400 Original-Received: from mail-ed1-f48.google.com ([209.85.208.48]:46717) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pg6eC-0003Ib-3d for 62412@debbugs.gnu.org; Sat, 25 Mar 2023 12:21:40 -0400 Original-Received: by mail-ed1-f48.google.com with SMTP id eg48so19385148edb.13 for <62412@debbugs.gnu.org>; Sat, 25 Mar 2023 09:21:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1679761294; h=content-transfer-encoding:mime-version:user-agent:message-id:date :references:in-reply-to:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=5AanYPi7WyAn7+t0ORaK9190jqkmhZaXCVjwMOrz6zA=; b=Yw07UyFWZCNO3J2iL61s366KP606K5FbdUR0p7xY9yJKr8PKrb4E5CrabjJNYx4W9S l/SBmEW6C0itKE+6+BY9A/zKCmIBcN5OZNABXE5tSIzsqucO2ptoTt6z4hQk/L/+xQ4F 8rd+GmyF++ll88nDVDmaT8Lw27dDd/Fc/RlTYqXKOGHXfifDi4kaQa3mSOXfCmZsPRF5 xJpfcro5TEdQ6kLlMbJ1HlYzAZGAxqohphbOF2ERsEKS366fz1GO90IgwNKRsJsgcmH5 AAff3xM3uJhfSTYmGJSq7b/r0w8K1SfuJc1z/gjCHOnuifXjRuMBQ1JEFvgv3EmiEr81 nfWw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1679761294; h=content-transfer-encoding:mime-version:user-agent:message-id:date :references:in-reply-to:subject:cc:to:from:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=5AanYPi7WyAn7+t0ORaK9190jqkmhZaXCVjwMOrz6zA=; b=I6AzvNzp9rMtKLNxWQU+W46YAy1TswkPkEAmjzPqFel095HZNa7smRhd+HOBMIlGCQ uooLNZ35HkJCzM+/d98TgXLj3NaPIr/ZYoTuvaonOGzdmUgVY4rG+d8SE3kobWjYRrVB 9NfabwnUMN4O68bf5bA39rWgke1v92/ciFQhHITJptS8FeK8E+936xG0PIAhdlimC5JW K/OpZd1NueTG6clvosW2Ge8/OaPpu7Qg+ArZLEnlkjlonEVaip1QhN2YR2oFNYvxwSsQ 9o4RU0FiAF58tdu1hYU0g8F4cfLT1Sqcj1mwD0LNo3dcdtqTLj/D08zu110OqVBW+s39 6Oug== X-Gm-Message-State: AAQBX9ckOUXD7lKnK1+zppaQw1rEdVKIudbwpnN3qj8k4cj4JKa7rJwo EhM4iIcWKpetfVFW1Rq+v7zR1C4x5ag= X-Google-Smtp-Source: AKy350a6WE7KxeZaEndgJGxYGFpl5xEVQ4c2aPCHa7bBLYMzlzvh8f/UrVN5hx44u4TEQcxwnug91A== X-Received: by 2002:a17:906:8402:b0:87f:5d0a:c610 with SMTP id n2-20020a170906840200b0087f5d0ac610mr7237759ejx.32.1679761294112; Sat, 25 Mar 2023 09:21:34 -0700 (PDT) Original-Received: from krug (87-196-74-168.net.novis.pt. [87.196.74.168]) by smtp.gmail.com with ESMTPSA id q7-20020a170906b28700b00931c887372dsm11774939ejz.107.2023.03.25.09.21.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 25 Mar 2023 09:21:33 -0700 (PDT) In-Reply-To: <72d72cd6-4fa8-2df3-f45d-5bf5845e4f38@gmail.com> ("Herman, =?UTF-8?Q?G=C3=A9za?="'s message of "Sat, 25 Mar 2023 14:48:05 +0100") 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:258596 Archived-At: "Herman, G=C3=A9za" writes: > On 3/25/23 12:43, Jo=C3=A3o T=C3=A1vora wrote: >> >> There can be no "correct" indentation in a buffer with an invalid state. >> >> But there are heuristics. Here, it can be argued that c++-mode's >> heuristics are better. > I agree. In my opinion, c++-mode's heuristics are good. That's probably only because we're _used_ to c++-mode. If we had been using c++-ts-mode for years, we would be equally suprised. > Tree-sitter support is new, it's expected that it won't work > perfectly. Also, it doesn't have to handle any invalid program. But, > while writing a program, it should handle indentation sensibly. I > don't think that it's a good approach that everybody who uses electric > indent should get used to the fact that whenever they writing a for > loop, the line will jump around. It's a bad experience. But writing a for loop from scratch is only one of the editing activities you do in a C++ file. Other activities involve editing existing code. In those situations, c++-ts-mode's heuristics could "win". Unless you're willing to posit that writing code from scratch is more frequent than editing existing code, there's no right answer here. > Anyways, feel free to close this issue if you think otherwise. I just > disabled ';'-caused auto indenting, so I don't see this unpleasant > behavior any more. Yes, i'm inclined to think that c++-ts-mode shouldn't add any chars to electric-indent-chars. It's just not useful. Jo=C3=A3o