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 17:00:42 +0300 Message-ID: <83wn2y49v9.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> <83bkka5z7w.fsf@gnu.org> <87mt3uwlc0.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="21714"; mail-complaints-to="usenet@ciao.gmane.io" Cc: dgutov@yandex.ru, dancol@dancol.org, casouri@gmail.com, emacs-devel@gnu.org, theo@thornhill.no, geza.herman@gmail.com To: =?utf-8?B?Sm/Do28gVMOhdm9yYQ==?= Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Thu Mar 30 16:02:04 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 1phsqp-0005WM-IB for ged-emacs-devel@m.gmane-mx.org; Thu, 30 Mar 2023 16:02:03 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1phspm-0006To-KY; Thu, 30 Mar 2023 10:00:58 -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 1phspj-0006TJ-41 for emacs-devel@gnu.org; Thu, 30 Mar 2023 10:00:55 -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 1phspR-0007l5-ES; Thu, 30 Mar 2023 10:00:52 -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=P2TqBgeJTrj49vfOlOW5RQQSILpJ4pouwyEbupXbLAE=; b=M279Ka51e4J5Zbvp4l3Z uoZR/wTy376zgAh9YLAfHwLf0ImoV3NBcuvSzoxVHxQ9T0GA20vACJRCAhdoDJffVDk0fYICHH9U5 ntFRTv9Zf8EbkLWuF5t6ZOtuxnQEdoU8Dt2CASJTM1tfGwE15pjujflibKTyXaolTyEPw8yjjj4nJ BHrm6TFi1H5ycKypMSvjzi2BdUjBDpMMm/DXvBGHOHvDUhyjqkJlefOTUTNxNvx1/3drL27wrKv3y oeNVYZZ+Wt/aumDlAM8FA9mN33Gez9/pFC6l7hQ1OTdwccZYoG7IcHAcatn4XdFw9ctji30f51nmW urv8JG9orP4vxA==; 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 1phspL-0004zG-HB; Thu, 30 Mar 2023 10:00:36 -0400 In-Reply-To: <87mt3uwlc0.fsf@gmail.com> (message from =?utf-8?B?Sm/Do28g?= =?utf-8?B?VMOhdm9yYQ==?= on Thu, 30 Mar 2023 12:05:35 +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:304865 Archived-At: > From: João Távora > Cc: dgutov@yandex.ru, dancol@dancol.org, casouri@gmail.com, > emacs-devel@gnu.org, theo@thornhill.no, geza.herman@gmail.com > Date: Thu, 30 Mar 2023 12:05:35 +0100 > > Eli Zaretskii writes: > > > 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. > > You don't need me to install changes, do you? Yes, I do. If I had to install all the changes myself, Emacs could never be moving forward as fast is it does today, and wouldn't be what we see now. This is a community project; without active collaboration of all the contributors it wouldn't be such a success. It should go without saying that when someone proposes a change and the discussion then concludes the change needs small adaptations, the person who proposed the change will then go ahead and install those small adaptations. Without such minimal collaboration, we as a project will get nowhere. > >> 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. > > No. I use c++ mode with its bindings like c-electric-paren deactivated. > I still use electric-indent-mode with its very reasonable default value > for of (?\n) I suspect that this is the root cause why you find c++-ts-mode so jarring: since you disable all the electric behavior in C++ mode except the one bound to newline, you are not used to electric reindentation, except when you type RET. But that is not the default. I do use the default settings of all the CC Mode electric characters (with very few minor customizations), and so I do see the electric reindentation in c++-mode all the time, and am used to it. If most users don't disable the default electric behavior in CC Mode, they will not see c++-ts-mode behavior as "jarring". The difference between c++-mode and c++-ts-mode is that the latter doesn't (yet) let you customize each electric character separately. This could be a subject of future extensions, but for now, as Dmitry points out, it is easy to override the value of electric-indent-chars in a mode hook, and leave only the newline in it -- this should give you a better approximation to what you are used to in c++-mode, I think. > So far I don't think anyone here has said they _like_ the bouncing. It depends on how much it does that. What I saw until now is not different from what I see in CC mode with the default electric behavior, in which case I'm okay with that. > But maybe someone does.. I wasn't even the first to report this. > Daniel did in this list and Geza Herman did in #61412. Maybe Daniel also disables the electric behavior of CC mode? In any case, customizing electric-indent-chars could solve Daniel's problems as well. > >> 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). > > We have different ideas of bouncing. No, I don't think so. We just perceive it differently. Also, I think your description said that each semi-colon inside "for" causes reindentation, and I don't see that > >> 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. > > Never said it's a "catastrophe". Just annoying/jarring/suprising > behaviour that you don't get with vanilla c++-mode or modes based on > cc-mode. I think that electric-indent-chars was designed with those > modes in mind. Didn't we just establish that you modify the vanilla behavior of c++-mode by disabling the electric behavior of all the characters except the newline? If so, users who don't disable will not see the electric reindentation as jarring. > I'm using the latest master (560c27a3) and starting it with > > src/emacs -Q `mktemp`.cpp -f c++-ts-mode > > > Also, which version of the tree-sitter C++ grammar library do you have > > installed? > > I don't know how to answer that. I used M-x > treesit-install-language-grammar RET "cpp" and accepted the default in > all prompts. I presume it installs the latest version of the Git repo. > I've just reinstalled today. Then I don't know why we don't see the same behavior. Beats me. > You can _see_ in the GIF what I type. I've just using normal keys for > self-insert. Then C-p, and some C-f to position my cursor before the > ';;', then C-d to delete the two ';;'. And then add them back again with > two ';;'. After the first ';' the line goes back, then the second one, > and the line goes forward ';'. Similar things happen with CC mode. Perhaps not in this particular situation, but in others. > Also see the original recipe of bug#62142, which is quite easy to > follow, for more bouncing. Can't you reproduce this either? I'm confused by the description there, and we just discovered that you said there to disable electric-indent-mode when you really meant electric-pair-mode. So maybe post a revised example there (or here), this time without any mistakes, and let's take it from there.