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: Sat, 25 Mar 2023 18:41:37 +0100 Message-ID: <3FB95B26-42DD-4394-B8D7-AF0CBE079781@thornhill.no> 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> 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="7859"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Yuan Fu , 62412@debbugs.gnu.org To: =?UTF-8?Q?Jo=C3=A3o_?= =?UTF-8?Q?T=C3=A1vora?= , 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 18:42:21 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 1pg7uH-0001jZ-1B for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 25 Mar 2023 18:42:21 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pg7u1-0002kl-4U; Sat, 25 Mar 2023 13:42:05 -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 1pg7tz-0002fT-LS for bug-gnu-emacs@gnu.org; Sat, 25 Mar 2023 13:42:03 -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 1pg7ty-00042J-5o for bug-gnu-emacs@gnu.org; Sat, 25 Mar 2023 13:42:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1pg7tx-0007yt-Sd for bug-gnu-emacs@gnu.org; Sat, 25 Mar 2023 13:42: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: Sat, 25 Mar 2023 17:42: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.167976610830659 (code B ref 62412); Sat, 25 Mar 2023 17:42:01 +0000 Original-Received: (at 62412) by debbugs.gnu.org; 25 Mar 2023 17:41:48 +0000 Original-Received: from localhost ([127.0.0.1]:43404 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pg7tk-0007yR-I7 for submit@debbugs.gnu.org; Sat, 25 Mar 2023 13:41:48 -0400 Original-Received: from out-63.mta1.migadu.com ([95.215.58.63]:58829) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pg7th-0007yH-MD for 62412@debbugs.gnu.org; Sat, 25 Mar 2023 13:41:47 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=thornhill.no; s=key1; t=1679766101; 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=AmAIHrHNjzbhGjnTx+Uqy3mbm4by0Vci8vsLIQJtVOs=; b=M3XYQI71LtTw6i/6r8/CjuimlbVp00uE1/sqLOfR5ZDJCQBh2aGhvsK265dQT2O18cgGWw Xm9NSCcO7adzsapSG75ZxmvgW03xZNDJrxUizBEv1ioATCJW5onOR1h6s8a2XYvP2E7VxF VVh3bkE3CM7gAqygzl+ekNTQsJS9DSSfjE8DRIhsJwbBWz5WaerV+9k79t3uuV9n8AXQYi SoSEfYS6H3wSZfCYbCweFjVf6ud4Gm40glPqYW2RgUSIF2xlf1YBY0llUx/Sonc5gz5INk pBbwH2FqAQvNV57M9NHcAY1iaOQLUxw76tTAylGu8h6OqyBnaXfs5jomFMDIkA== X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. In-Reply-To: <87o7ogx0jc.fsf@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:258609 Archived-At: On 25 March 2023 17:23:35 CET, "Jo=C3=A3o T=C3=A1vora" wrote: >"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 stat= e=2E >>> >>> But there are heuristics=2E Here, it can be argued that c++-mode's >>> heuristics are better=2E >> I agree=2E In my opinion, c++-mode's heuristics are good=2E > >That's probably only because we're _used_ to c++-mode=2E If we had been >using c++-ts-mode for years, we would be equally suprised=2E > >> Tree-sitter support is new, it's expected that it won't work >> perfectly=2E Also, it doesn't have to handle any invalid program=2E But= , >> while writing a program, it should handle indentation sensibly=2E 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=2E It's a bad experience=2E > >But writing a for loop from scratch is only one of the editing >activities you do in a C++ file=2E Other activities involve editing >existing code=2E In those situations, c++-ts-mode's heuristics could >"win"=2E Unless you're willing to posit that writing code from scratch i= s >more frequent than editing existing code, there's no right answer here=2E > >> Anyways, feel free to close this issue if you think otherwise=2E I just >> disabled ';'-caused auto indenting, so I don't see this unpleasant >> behavior any more=2E > >Yes, i'm inclined to think that c++-ts-mode shouldn't add any chars to >electric-indent-chars=2E It's just not useful=2E > >Jo=C3=A3o I won't object to this, as I hold no strong opinions either way=2E Would r= emoving it cause less confusion, yet still reindent correctly in most cases= ? If so, feel free to remove it, unless anyone else objects :) Theo