From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.devel Subject: Re: treesit indentation "blinking" Date: Thu, 30 Mar 2023 13:07:47 +0300 Message-ID: <83bkka5z7w.fsf@gnu.org> References: <87h6ucik61.fsf@dancol.org> <0F406D08-56D4-4B21-B94D-A47681606911@gmail.com> <1870bcadd28.2829.cc5b3318d7e9908e2c46732289705cb0@dancol.org> <1870cce6690.2829.cc5b3318d7e9908e2c46732289705cb0@dancol.org> <35A837A9-59B4-4F1F-A5FA-8483C8024D76@gmail.com> <187104f6b48.2829.cc5b3318d7e9908e2c46732289705cb0@dancol.org> <21d018e5-a730-12e3-f97c-fffa4f646ccf@yandex.ru> <83v8ioc2ou.fsf@gnu.org> <87sfdsx0r2.fsf@gmail.com> <87lejgsf0m.fsf@gmail.com> <83pm8s70o3.fsf@gnu.org> <83mt3u65vw.fsf@gnu.org> <87y1newqus.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="21296"; mail-complaints-to="usenet@ciao.gmane.io" Cc: dgutov@yandex.ru, dancol@dancol.org, casouri@gmail.com, emacs-devel@gnu.org, theo@thornhill.no To: =?utf-8?B?Sm/Do28gVMOhdm9yYQ==?= Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Thu Mar 30 12:08:37 2023 Return-path: Envelope-to: ged-emacs-devel@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 1phpCv-0005M1-AA for ged-emacs-devel@m.gmane-mx.org; Thu, 30 Mar 2023 12:08:37 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1phpC8-0004Pp-PT; Thu, 30 Mar 2023 06:07:48 -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 1phpC7-0004P3-MK for emacs-devel@gnu.org; Thu, 30 Mar 2023 06:07:47 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1phpC6-0007nB-1j; Thu, 30 Mar 2023 06:07:46 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-version:References:Subject:In-Reply-To:To:From: Date; bh=7mfD6Tvqzhpz/6oYOr7d17uPmEKtvQZeSOS5X4UDMI0=; b=GJhoGooBwFAE9bnn+K4S l2cjFe0QI8jCs3LULeHRp/BwVJv+QdeTpV5QqvKXEE+++QnNC8lxyyC+a3wkS4QFYB2NZfMICiN7v nTw/3pKE4KhP3dSwDuD3/UjdORo1sC5WRyWBv9FSRxBKpHX/k/fXmMpAfGTtCUB3r1ts/2KyWdkEy ng/G5Cl9BzPkcP+cOFkafISGzQOQA91qJGh4on8Yo87mXRvNHE5Itotb3iT5hzYwugvPIVFHhP7K9 EyeaNtbOcUropr9mPes3CLMpIQ86T8MA8AsAGIH2Bd6TXVP0375Mv6WHstklKj57RHKGkgcMhoSlT 4k93t2+tWkY7+Q==; Original-Received: from [87.69.77.57] (helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1phpC1-00084G-If; Thu, 30 Mar 2023 06:07:45 -0400 In-Reply-To: <87y1newqus.fsf@gmail.com> (message from =?utf-8?B?Sm/Do28g?= =?utf-8?B?VMOhdm9yYQ==?= on Thu, 30 Mar 2023 10:06:19 +0100) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.devel:304852 Archived-At: > From: João Távora > Cc: dgutov@yandex.ru, dancol@dancol.org, casouri@gmail.com, > emacs-devel@gnu.org, theo@thornhill.no > Date: Thu, 30 Mar 2023 10:06:19 +0100 > > Eli, I'm just trying to help. I don't use c++-ts-mode yet. It's still > very immature IMO. Someone in this thread mentioned electric-pair-mode, > a mode I authored, and its (positive) effects on bouncing indentation. > > Apparently noone had looked into electric-indent-chars for the cause, or > provide a recipe. I did and proposed a trivial solution for anreal > problem that I wasn't the first or even the second to witness. FWIW, I don't see any problem that needs fixing, not yet. > If you don't like my patch, it's fine. Use the results of my > experiments as you see fit. But just don't want to figure out a > defcustom name, a default value, etc and contribute to an Emacs with > more defcustoms for areas where I personally believe defcustom aren't > the answer. I won't stop anyone from adding one. I suggested a defcustom because I blindly believed your description and your analysis. Now that I have tried reproducing the issues you describe, and cannot see the problems you describe, I no longer think there's a problem that justifies removal of electric-indent-chars customization by c++-ts-mode, with or without the defcustom. > Is this "unfriendly"? Geez. What _is_ unfriendly is to refuse to install a change that you yourself consider required, when asked to do that conditionally, so users who still want the electricity, even though it "blinks", could still have it. I think the request is reasonable, especially since you don't use this mode, and so can easily overlook some useful behavior that your proposed change could disable or break. > > First, I don't agree with your conclusion that the local setting of > > electric-indent-chars in c-ts-base-mode causes divergent behavior wrt > > its CC mode equivalents. In particular, the example you brought up in > > > > https://lists.gnu.org/archive/html/emacs-devel/2023-03/msg00939.html > > > > behaves the same in c++-mode, at least in "emacs -Q": "std:" (with a > > single colon) causes reindentation as if this were a label, and adding > > another colon indents back to column 2. So at least in this example > > the behavior I see is the same in both modes. > > I didn't realize that, because I use c++-mode with its electric features > off. If you turn electric features off, then electric-indent-chars will have no effect whatsoever, and all this discussion is moot. > I think within 5 minutes of editing, someone used to c++-mode -- even > with its default electricity -- will start to feel unconfortable with > c++-ts-mode. We shall see, okay? You could be right or you could be wrong. The purpose of releasing these modes in Emacs 29 is to collect user feedback, so we know in which direction(s) to develop them further. Your opinions are noted, but let's give others chance to voice theirs, okay? > I saw bouncing in lots of other places, bouncing that I > know I just don't see with c++-mode. If I ever pick it up again, I'll > let the ts people know. Please report any problems you see when you see them, so that we could fix those that are still there. > > Also, at least some of the examples for a different behavior between > > c++-mode and c++-ts-mode explicitly turned OFF electric-indent-mode. > > For example, see > > > > https://debbugs.gnu.org/cgi/bugreport.cgi?bug=62412#14 > > > > When electric-indent-mode is turned OFF, setting electric-indent-chars > > cannot possibly make any difference, right? > > > > (Btw, I cannot reproduce what the first example there says: if I turn > > OFF electric-indent-mode, RET doesn't correctly indent the next line; > > instead, the next line is not indented at all. So I wonder what is > > being missed here.) > > What's being missed is that perhaps you're mixing electric-pair-mode > with electric-indent-mode? In these tests I never turned off e-i-m, > because it's on by default in Emacs. The above message as part of bug#62412 clearly says "Let's assume you turn off electric-indent-mode." I interpreted that as meaning that electric-indent-mode is to be turned off for the rest of the examples to do what you mean them to do. > I already gave this alternative MRE of bouncing behaviour. > > emacs -Q `mktemp`.cpp -f c++-ts-mode > > i n t SPC m a i n ( ) { RET for ( ; ; ) SPC b l a ( ) ; > > Can you reproduce this bouncing? No, I cannot. All I see is that the semi-colon after "foo()" indents the line, just once, so that it has the correct indentation (previously it had no indentation at all). > Now try the same with c++-mode. Do you confirm that it doesn't > bounce? The only difference I see is that c++-mode indents the line with "for" right from the start, after I type RET. Which is better indeed, but what c++-ts-mode does is not a catastrophe, either. > Also in c++-ts-mode, add a closing `}`. See the "mismatched > parenthesis"? No, I don't. Are you using Emacs 29 or Emacs 30? I'm using the former. Also, which version of the tree-sitter C++ grammar library do you have installed? > Now I'm going to give another example. In the same file, go back to > c++-ts-mode. Say you spotted a mistake and dont want an infloop after > all. Go and delete the two ';;' in the for expressions, leaving, say > just the parenthesis. Start typing another set of expressions. Please state exactly what to type, otherwise we will again be talking past each other. > See the bouncing back and forth? I've even made a gif of this. I see it in your GIF, but not on my system.