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 16:39:04 +0300 Message-ID: <83y1ne4avb.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> <871ql6a4d4.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="27299"; mail-complaints-to="usenet@ciao.gmane.io" Cc: joaotavora@gmail.com, dgutov@yandex.ru, dancol@dancol.org, casouri@gmail.com, theo@thornhill.no, emacs-devel@gnu.org To: geza.herman@gmail.com Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Thu Mar 30 15:40:03 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 1phsVW-0006qb-Uj for ged-emacs-devel@m.gmane-mx.org; Thu, 30 Mar 2023 15:40:02 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1phsUd-0008P5-6L; Thu, 30 Mar 2023 09:39:07 -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 1phsUV-0008Ob-KV for emacs-devel@gnu.org; Thu, 30 Mar 2023 09:39:00 -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 1phsUS-0004o3-IJ; Thu, 30 Mar 2023 09:38:58 -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=BCuoFRbEm1Cr76Wo19eP22px6ebJ3j0hbaHJn8Indvo=; b=AHDeLqwf7T/IpsyuIdB8 JSiOSBMhN+W64+AzpGimulL2OfGNux2MAoA+V1W3sS8wJglKXULIpdIlH0l34a6EUQEg/sPZQPZhy 7FeH4dow50VNdvQHRmGIdTLvbadTcPPcSNBstFmhLM45UUeC0ihCGhGvjYe/IJKqITWhkq+6DggvC hp2Auh2LZDQZPq0yarOxDKZlOlzhxOnm4QSyeuk5brhM89VqUZrRyPm1mcK+8WZfX8ExKACegUGNg NWADOPPMppvTISBoJkkzCtjr9tqh8x5eGWFqvg7fZwWnhHejLbS1n019KEatL7WhVtKyYxio8xzff CFWbB2o3IzHQGA==; 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 1phsUP-00075v-1N; Thu, 30 Mar 2023 09:38:56 -0400 In-Reply-To: <871ql6a4d4.fsf@gmail.com> (message from Herman, =?utf-8?Q?G?= =?utf-8?Q?=C3=A9za?= on Thu, 30 Mar 2023 12:26:16 +0200) 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:304864 Archived-At: > From: Herman, Géza > Cc: João Távora , > dgutov@yandex.ru, dancol@dancol.org, > casouri@gmail.com, theo@thornhill.no, emacs-devel@gnu.org > Date: Thu, 30 Mar 2023 12:26:16 +0200 > > > Eli Zaretskii writes: > > > [...] Which is better indeed, but > > what c++-ts-mode does is not a catastrophe, either. > > Maybe it's not a catastrophe, but it's far from behaving well. > > Type this example into a c++-ts-mode buffer (I used "emacs -Q"): > > --8<---------------cut here---------------start------------->8--- > int main() { > for (;;) { > printf("Hello world\n"); > } > } > --8<---------------cut here---------------end--------------->8--- > > This is how it will be indented as I wrote it here. c++-ts-mode doesn't > re-indent anything during typing, even though it had the chance to do > that, because electric-indent-mode is enabled by default, and > electric-indent-chars contains the necessary characters. > > Or, another example. Put the "void foo() { }" part first into a > c++-ts-mode buffer, then write the main function: > > --8<---------------cut here---------------start------------->8--- > int main() { > int a = 0; > for (;;) { > printf("Hello!\n"); > } > } > > void foo() { > } > --8<---------------cut here---------------end--------------->8--- > > Again, c++-ts-mode doesn't indent anything. > > If you change the example to contain "void foo();" instead of "void > foo() { }", then indenting happens during typing the main function. > > If you try adding "int a = 0;" into the first example, then it will be > indented at typing the ";". But then for loop is still not get indented, > and the buffer will look like this: > > --8<---------------cut here---------------start------------->8--- > int main() { > int a = 0; > for (;;) { > printf("Hello world\n"); > } > } > --8<---------------cut here---------------end--------------->8--- > > If you start by adding an empty comment, and then write the first > example above the empty comment, the buffer will look like this: > > --8<---------------cut here---------------start------------->8--- > int main() { > for (;;) { > printf("Hello world\n"); > } > } > > /**/ > --8<---------------cut here---------------end--------------->8--- > > Can you reproduce these? These happen both with emacs-29 and > several-day-old master with the latest tree-sitter-cpp (but it also > happens with a ~1 month-old tree-sitter-cpp). Thanks for the examples, but how are they related to the issue at hand? We are discussing the possibly adverse effects that electric-indent-mode and the customization of electric-indent-chars by c-ts-base-mode might have on user experience while typing C/C++ code. Are you saying that removing the customization of electric-indent-chars by c-ts-base-mode solves the problems you mention? If not, then I think your examples should go into a separate bug report, which should be investigated separately.