From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Herman@debbugs.gnu.org, =?UTF-8?Q?G=C3=A9za?= Newsgroups: gmane.emacs.bugs Subject: bug#62412: 29.0.60; strange c++ indentation behavior with tree sitter Date: Sat, 25 Mar 2023 18:47:11 +0100 Message-ID: References: <2496F2A0-3EB1-4CD2-B299-E1DC41B7C23B@gmail.com> <46A6C705-97DA-4D17-999B-0536F01EFCA7@thornhill.no> <72d72cd6-4fa8-2df3-f45d-5bf5845e4f38@gmail.com> <87o7ogx0jc.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="4158"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.2.1 Cc: Yuan Fu , Theodor Thornhill , 62412@debbugs.gnu.org To: =?UTF-8?Q?Jo=C3=A3o_?= =?UTF-8?Q?T=C3=A1vora?= Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Mar 25 18:48:13 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 1pg7zw-0000pG-Ga for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 25 Mar 2023 18:48:12 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pg7zo-0005SW-JH; Sat, 25 Mar 2023 13:48:04 -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 1pg7zl-0005Qq-U8 for bug-gnu-emacs@gnu.org; Sat, 25 Mar 2023 13:48:01 -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 1pg7zl-00066S-Mf for bug-gnu-emacs@gnu.org; Sat, 25 Mar 2023 13:48:01 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1pg7zl-0008Bc-Ip for bug-gnu-emacs@gnu.org; Sat, 25 Mar 2023 13:48:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Herman@debbugs.gnu.org, =?UTF-8?Q?G=C3=A9za?= Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 25 Mar 2023 17:48: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.167976644131293 (code B ref 62412); Sat, 25 Mar 2023 17:48:01 +0000 Original-Received: (at 62412) by debbugs.gnu.org; 25 Mar 2023 17:47:21 +0000 Original-Received: from localhost ([127.0.0.1]:43429 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pg7z6-00088e-Tc for submit@debbugs.gnu.org; Sat, 25 Mar 2023 13:47:21 -0400 Original-Received: from mail-ed1-f48.google.com ([209.85.208.48]:38546) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pg7z5-00088R-8r for 62412@debbugs.gnu.org; Sat, 25 Mar 2023 13:47:19 -0400 Original-Received: by mail-ed1-f48.google.com with SMTP id r11so20069048edd.5 for <62412@debbugs.gnu.org>; Sat, 25 Mar 2023 10:47:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1679766433; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=irH49+WQQRuUCxatcALEwnkihw8gboHtHGNY3xbd2Rg=; b=PQ7zUcYwE/xOeTot4dOfUNUDgMWTwDrf/ezx6TVMrJFhJGJS6MLYjgeZqIT6nNi7x7 YxZiDqGwms1Qjab4ityEj726uwsaB1SHAD/dRXe1MRzlr/MAtF9WQQ4iJhaRb+hlBK5Q Yfc6BvhCbRgYSFdqz4BjOQ0dpLm/qz2hGPtsJN5H0buERqLncwZ4CCJakzLAKwMG+nd0 CIREJYhaSuyQOzrCbllmw8GSCpV0CffgAcWMggMeinGehf0/+d+rfosr+aPYdk+oyD9e 4Yjt3frSf67QBJTALD/9qhbSSeT6ft0kIgJu94aY2g6S2XVRHdBLc35Xl6fP4OrSE6Iy f40g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1679766433; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=irH49+WQQRuUCxatcALEwnkihw8gboHtHGNY3xbd2Rg=; b=21giAjjybvyKaciZfzJ85D5DITKRX6vbQJnnEBdkTQMthmaky83Unyf6KEYQwtqmo2 ApW/BHLfxJE4wg5BTLlxpTTQmck8L42T1803UrtTI/q1GlityarbVET9PI/HZwY1FGdx HNgwjH9FRyuVDyyze6FGKNPlcE7GjTee+N8CWSUow+prassRTJSoh0dNq2jSK/eWDZkS YJWeBLVzeYrgaZtAHTxpUM6wR6idGTUqSzXFkABjLq9UhmAj9rjc49WJp5YtGDSBD432 76M0NZGNRQZcct16v8dzAAlYvx04oeVSSM7Agd8HiK7ByDh4J+ByT4Y/wQLG5Dc/qYPw +y0A== X-Gm-Message-State: AAQBX9dP5+WqxhutVItCbmV8R2MsWztya2TkukvO45PbyOq4FnfEG8iO H4J3mb4AjHD0GdvB1505myg= X-Google-Smtp-Source: AKy350avpxqxzw0pElG6S/YrKOW4CfpwFXAoLtNGMyKCQQS9VBpO4y6c/L1x22swrxuUUSx672NQTA== X-Received: by 2002:a17:906:fc5:b0:928:de2a:8a3f with SMTP id c5-20020a1709060fc500b00928de2a8a3fmr6670216ejk.31.1679766433111; Sat, 25 Mar 2023 10:47:13 -0700 (PDT) Original-Received: from [192.168.8.4] (netacc-gpn-204-88-167.pool.yettel.hu. [5.204.88.167]) by smtp.gmail.com with ESMTPSA id lz24-20020a170906fb1800b009334309eda5sm10196195ejb.196.2023.03.25.10.47.12 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sat, 25 Mar 2023 10:47:12 -0700 (PDT) Content-Language: sv-FI In-Reply-To: <87o7ogx0jc.fsf@gmail.com> 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:258610 Archived-At: On 3/25/23 17:23, João Távora wrote: > >> 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. Yes, that can be true. > >> 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. What is the c++-ts heuristics here so it removes the indentation? I don't really understand why it does that. Is there a similarly looking situation where removing the indentation is the sensible behavior? >> 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. > As far as I know, c++-mode has ';'-caused auto indenting, it just works with a different mechanism. So if the aim is that the two c++ modes should work similarly out of the box, then it'd make sense to keep electric-indent-chars as is.