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:58:21 +0300 Message-ID: <83jzyy4776.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="4656"; mail-complaints-to="usenet@ciao.gmane.io" Cc: geza.herman@gmail.com, dancol@dancol.org, emacs-devel@gnu.org To: casouri@gmail.com, theo@thornhill.no Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Thu Mar 30 16:58:49 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 1phtjl-00016k-Tr for ged-emacs-devel@m.gmane-mx.org; Thu, 30 Mar 2023 16:58:49 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1phtjD-00040C-VT; Thu, 30 Mar 2023 10:58:15 -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 1phtjB-0003zO-9C for emacs-devel@gnu.org; Thu, 30 Mar 2023 10:58:13 -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 1phtj9-0000JA-M5; Thu, 30 Mar 2023 10:58:11 -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=lGvLRuRTXXqvSICr8XJYCWGYCbZtXw4ufbk6Br8iNck=; b=Oj1xTL6SdB81t1XLBvge nvXIZ6JdBZplj+4+d+Nv6Ig995PrDjKuQoKc5fNwjUy712Wb3oicd3Xt8Pqx3bGVqLZdY6vRJfM3k 2ITCKZ5DcyMyczA+Sj20T3H4Xu2VAG0jcdFwZciUtLG6NKb9VH4johndBkB12yfx3B+rq58kae7JB no7lLo7kk7F8+Ekzk8WzVmvatVjZUV0w1mZM1dMaYiu4KdmIXRqhqwCq6M0yyQP0vVJ4u1GUQDFng 5dzz+4hDG9QHQrIP29jqbuo3UJm9JPLLxNU1gOQTbahuOko9/7ynC03djTFdXTQX7+bEi4kGqNBgD rsDmic65SDo/bQ==; 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 1phtj9-0006O3-2n; Thu, 30 Mar 2023 10:58:11 -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:304870 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 > > 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--- Yuan and Theo, can you please look into these examples? A simple "C-c C-q" fixes the indentation, but the question is why it doesn't happen while typing?