From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Yuan Fu Newsgroups: gmane.emacs.devel Subject: Re: treesit indentation "blinking" Date: Sat, 1 Apr 2023 12:39:15 -0700 Message-ID: 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> <83jzyy4776.fsf@gnu.org> Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3731.400.51.1.1\)) 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="10409"; mail-complaints-to="usenet@ciao.gmane.io" Cc: theodor thornhill , geza.herman@gmail.com, Daniel Colascione , emacs-devel@gnu.org To: Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sat Apr 01 21:40:19 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 1pih5H-0002Xt-Bj for ged-emacs-devel@m.gmane-mx.org; Sat, 01 Apr 2023 21:40:19 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pih4X-0006ZS-7D; Sat, 01 Apr 2023 15:39:33 -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 1pih4V-0006ZD-3N for emacs-devel@gnu.org; Sat, 01 Apr 2023 15:39:31 -0400 Original-Received: from mail-pj1-x1035.google.com ([2607:f8b0:4864:20::1035]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pih4T-0001As-GZ; Sat, 01 Apr 2023 15:39:30 -0400 Original-Received: by mail-pj1-x1035.google.com with SMTP id lr16-20020a17090b4b9000b0023f187954acso26868492pjb.2; Sat, 01 Apr 2023 12:39:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1680377967; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=q2rzsDex58Ms94TjVEWqt/dKh4/+RsxEXisSdxjSTIE=; b=lUqxpkeFqcZzcbiB9mJAU/GpbmhVV9w879jSZVTdlWw1TH/YYNgdjKjgzQHZOIxmSO klBSFSO6RiwRe4y5IM1fVVHMdBW4reFBF02rvCh5LiH4K7ZxE26GzcylHniVTHutoI9P r9OanGvtz7oKGF4udpXc85V6z6fjaQ6KHgpYaOK2WWO5DP3yy2CS5HocMaBoTCKSnAmq FMjShBCU91K1jdaYivN1RhF5ZKYcmmshM299+AFNSNdnYCUQjdN+ayi599N21iD3HLRq 5bqGJx/RQSQCV7ia3s7mwUR63/3GJohQRZl4IMagU/f/Q70c41PyG0KznpEF4dVv+cob 2JWg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1680377967; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=q2rzsDex58Ms94TjVEWqt/dKh4/+RsxEXisSdxjSTIE=; b=iV9CDZVrNbmAFSPmzhMYipsjq0yM3OueqDyTb+SBz0PRmvGzVz2GO4MCVA7FXgKVuT jFN2QD5pSTiHi2xE4QM0hgcECvHWxkHDt7+HViwYPkeEMyGlP6O51ZWtca3GIhHPLWsH Y3EaYqooiq0tX24LI5Z+CL/08FDtFOsXmr3vag9ZzNaNSRfPFKsmGAfQKMlLUyXNUn4W q/HLfgsXSfnvb9U3lZSuSxlG+G5Xs0prlthhzEtvm4L++N2iEhMKWlMdZ0vMYP1+VwZh dlkjHH9Rlc8oAelSxycV3nfctDcsRAQ0b8Jzga4/+vsWqjPYf7glHLvj8Y680+uxbCDs lxMg== X-Gm-Message-State: AO0yUKVnL+swAkv1GG7JGfb3UZj4EqRTSRJPcyEKDix+dqnaF0FpzF1u hEfR0VDuFMMQ4PuyEqZ3w0vee885cRI= X-Google-Smtp-Source: AK7set/PHeRM38jY1JWOaCOz2xGZZDTqW2zTkQUIMpaTvFXfD12hVP7/iFsbG0CoCIcITb1m0c4cYg== X-Received: by 2002:a05:6a20:b55c:b0:da:a7db:48bb with SMTP id ev28-20020a056a20b55c00b000daa7db48bbmr26709302pzb.42.1680377967080; Sat, 01 Apr 2023 12:39:27 -0700 (PDT) Original-Received: from smtpclient.apple (cpe-172-117-161-177.socal.res.rr.com. [172.117.161.177]) by smtp.gmail.com with ESMTPSA id g20-20020a62e314000000b0062b5a55835dsm3910639pfh.213.2023.04.01.12.39.26 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sat, 01 Apr 2023 12:39:26 -0700 (PDT) In-Reply-To: <83jzyy4776.fsf@gnu.org> X-Mailer: Apple Mail (2.3731.400.51.1.1) Received-SPF: pass client-ip=2607:f8b0:4864:20::1035; envelope-from=casouri@gmail.com; helo=mail-pj1-x1035.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:305021 Archived-At: > On Mar 30, 2023, at 7:58 AM, Eli Zaretskii wrote: >=20 >> From: Herman, G=C3=A9za >> Cc: Jo=C3=A3o T=C3=A1vora , >> 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 >>=20 >> Type this example into a c++-ts-mode buffer (I used "emacs -Q"): >>=20 >> --8<---------------cut here---------------start------------->8--- >> int main() { >> for (;;) { >> printf("Hello world\n"); >> } >> } >> --8<---------------cut here---------------end--------------->8--- >>=20 >> 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. >>=20 >> Or, another example. Put the "void foo() { }" part first into a >> c++-ts-mode buffer, then write the main function: >>=20 >> --8<---------------cut here---------------start------------->8--- >> int main() { >> int a =3D 0; >> for (;;) { >> printf("Hello!\n"); >> } >> } >>=20 >> void foo() { >> } >> --8<---------------cut here---------------end--------------->8--- >>=20 >> Again, c++-ts-mode doesn't indent anything. >>=20 >> If you change the example to contain "void foo();" instead of "void >> foo() { }", then indenting happens during typing the main function. >>=20 >> 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: >>=20 >> --8<---------------cut here---------------start------------->8--- >> int main() { >> int a =3D 0; >> for (;;) { >> printf("Hello world\n"); >> } >> } >> --8<---------------cut here---------------end--------------->8--- >>=20 >> If you start by adding an empty comment, and then write the first >> example above the empty comment, the buffer will look like this: >>=20 >> --8<---------------cut here---------------start------------->8--- >> int main() { >> for (;;) { >> printf("Hello world\n"); >> } >> } >>=20 >> /**/ >> --8<---------------cut here---------------end--------------->8--- >=20 > 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? I=E2=80=99ll have a look! Yuan=