From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: =?utf-8?Q?Herman=2C_G=C3=A9za?= Newsgroups: gmane.emacs.devel Subject: Re: treesit indentation "blinking" Date: Thu, 30 Mar 2023 12:26:16 +0200 Message-ID: <871ql6a4d4.fsf@gmail.com> 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> 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="9980"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: mu4e 1.10.0; emacs 30.0.50 Cc: =?utf-8?B?Sm/Do28gVMOhdm9yYQ==?= , dgutov@yandex.ru, dancol@dancol.org, casouri@gmail.com, theo@thornhill.no, emacs-devel@gnu.org To: Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Thu Mar 30 13:05:14 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 1phq5i-0002LE-Bg for ged-emacs-devel@m.gmane-mx.org; Thu, 30 Mar 2023 13:05:14 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1phq5B-0001Zd-Al; Thu, 30 Mar 2023 07:04:51 -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 1phq4l-0001Ob-6O for emacs-devel@gnu.org; Thu, 30 Mar 2023 07:04:29 -0400 Original-Received: from mail-wm1-x332.google.com ([2a00:1450:4864:20::332]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1phq4R-00026V-IY; Thu, 30 Mar 2023 07:04:14 -0400 Original-Received: by mail-wm1-x332.google.com with SMTP id l15-20020a05600c4f0f00b003ef6d684102so7882437wmq.3; Thu, 30 Mar 2023 04:03:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1680174185; h=content-transfer-encoding:mime-version:message-id:in-reply-to:date :subject:cc:to:from:user-agent:references:from:to:cc:subject:date :message-id:reply-to; bh=+b5jCMrWOxkD8e6m84SuCvlr3TNQRxSypSs7sOcuJf8=; b=pQxLUEF+B2E/6yMv0YJfbZ2kQ/tVR/hjOsynM8tiE9jDUGbgy8mY8DEAa8H8wkwZTD /HjuNXL4Ehgd7M5zHLjs3lI+QRbGadhMenCqmk2pSN037DOoe/8KnMasz5fs/hLiZ3vo hm1Zz//4Y0iRxtivXB7OxP5GsurpgAStYy35he5+i4HiD2RF2EEerHDfX94YFZ3+DR8Y CHLqzB6Hh53bdvRbWYRCSLbcfHwAF3mey6roKrd0eyWSFAGYs6a9/RIaybhcFraN0eQC 9p4694YQeUarcTCrk78x5iabDN+BQjVMJ/Cx1pENFgLWNcsjTup5czvXvZdUQVVyxFS1 Pt+w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1680174185; h=content-transfer-encoding:mime-version:message-id:in-reply-to:date :subject:cc:to:from:user-agent:references:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=+b5jCMrWOxkD8e6m84SuCvlr3TNQRxSypSs7sOcuJf8=; b=RJzXeSeJiMa5QzxdMvZkqcfzEkF1PyC61+49IXZVYrgu9vjn8eJvGYULro5Wr3P9vC j+Xgf4bCI+pdx+muKF46aOJOhaBZP3M9wI682Mtj3oiC2GjIlqHYrkJEbYqp4WFSitJ1 s6SGLTT7d9fhiujSNWiQcEf2Yx1KDJPDXM6UMDJJrvEg2eUCPUzF56/hUm6B6fQz9sit S8WJlaf0n7/DhfU2lZNbNFTd86eP+9PQBZ6TUUvAe+eTn4JIqqSuLO4KR3WObQAm27hF 49X+a0DZyg9GxDq/t7tmT8Kt3dzT0CaxV0offnsbNywQghqnjv5eZrAkqh7REdTrpPWR nSqw== X-Gm-Message-State: AAQBX9eZErCx+7flKauFhfjrR8VWKwQGkpLpcr2IjiK+BZMLTYcNQc5A DnRd+5D29gkTzfHtsTLQCgVdNiuapuDGvA== X-Google-Smtp-Source: AKy350a/h5rZKpwiePhZRFJT8a8rSGn+S4tAO5LMlqDLhKPynr8PuhnzRoPbAUxPeTiMfVkG8JoROA== X-Received: by 2002:a1c:4b04:0:b0:3ed:c84c:7efe with SMTP id y4-20020a1c4b04000000b003edc84c7efemr4339605wma.7.1680174185112; Thu, 30 Mar 2023 04:03:05 -0700 (PDT) Original-Received: from localhost (netacc-gpn-204-88-167.pool.yettel.hu. [5.204.88.167]) by smtp.gmail.com with ESMTPSA id fc11-20020a05600c524b00b003ebff290a52sm5789087wmb.28.2023.03.30.04.03.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 Mar 2023 04:03:04 -0700 (PDT) In-reply-to: <83bkka5z7w.fsf@gnu.org> Received-SPF: pass client-ip=2a00:1450:4864:20::332; envelope-from=geza.herman@gmail.com; helo=mail-wm1-x332.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action 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:304858 Archived-At: 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 =3D 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 =3D 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 =3D 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). G=C3=A9za