From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Daniel Colascione Newsgroups: gmane.emacs.devel Subject: Re: treesit indentation "blinking" Date: Tue, 28 Mar 2023 19:57:25 -0400 Message-ID: <1872aa7ae88.2829.cc5b3318d7e9908e2c46732289705cb0@dancol.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> Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="1872aa7b243588c28299a1e128" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="3706"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: AquaMail/1.43.0 (build: 104300275) Cc: Dmitry Gutov , , , To: =?UTF-8?B?Sm/Do28gVMOhdm9yYQ==?= , Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Wed Mar 29 01:58:34 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 1phJCy-0000l2-8S for ged-emacs-devel@m.gmane-mx.org; Wed, 29 Mar 2023 01:58:32 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1phJCH-0006f4-D6; Tue, 28 Mar 2023 19:57: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 1phJC9-0006el-Ml for emacs-devel@gnu.org; Tue, 28 Mar 2023 19:57:41 -0400 Original-Received: from dancol.org ([2600:3c01:e000:3d8::1]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1phJC7-0002Bm-3s; Tue, 28 Mar 2023 19:57:41 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=dancol.org; s=x; h=Content-Type:MIME-Version:Subject:References:In-Reply-To:Message-ID: Date:CC:To:From:Sender:Reply-To:Content-Transfer-Encoding:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=2M6f6s/ggUf014qWS0s2C5alx9pG69lm60gvk5bY+H4=; b=daALxDFVIflQF7IXN3/Y/fLUoY uWWnPimFLmiEjYbeKJbD2R6mTONVbzfnAvv8xj9uwRvHP67yUckIi8yVF3ehQSGm7mxzLxdv3nfhu g3SWqsUxHH77tsM5dbY1NfHUNJ944TJqw5Las6arTPYB6Ox1tpI1QxHHaJ46A/5dibxwCOPOQgLC+ KRS4YrVt51Ha5g+QY6lWqjkbsTLuC7Z7DgMa6RPAsXqCbJNpcLApQZUQvinW8F3Sb2CVosUUBfPNV jpj9ThFybwvc6rjSnIc2exszNCTISiVkW+1LdWc9L65J85ChnpSuP0d0+KbnzP4xeZvPUC/pkbjWX j09CAF1Q==; Original-Received: from 74.sub-174-211-229.myvzw.com ([174.211.229.74]:4466 helo=[100.111.84.71]) by dancol.org with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256 (Exim 4.94.2) (envelope-from ) id 1phJBv-0001EZ-VO; Tue, 28 Mar 2023 16:57:29 -0700 In-Reply-To: <87lejgsf0m.fsf@gmail.com> Received-SPF: pass client-ip=2600:3c01:e000:3d8::1; envelope-from=dancol@dancol.org; helo=dancol.org 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, HTML_MESSAGE=0.001, SPF_HELO_PASS=-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:304812 Archived-At: This is a multi-part message in MIME format. --1872aa7b243588c28299a1e128 Content-Type: text/plain; format=flowed; charset="UTF-8" Content-Transfer-Encoding: 8bit Thanks. I hadn't gotten around to a recipe yet. How do other editors handle this situation? On March 28, 2023 18:09:11 João Távora wrote: > João Távora writes: > >> I think it's easier that c++-ts-mode doesn't touch that variable at all >> and leave it set to "\n". I can't see it being much use, with or >> without electric-pair-mode in the mix. > > Following up on this, I have now tried c++-ts-mode for a while now and > can confirm this jumping-around-while-typing is terrible without > electric-pair-mode, and still pretty bad even with electric-pair-mode. > > Here's just an example with emacs -Q + electric-pair-mode + c++-ts-mode > > Start typing > > i n t SPC m a i n ( ) SPC { RET > > The buffer becomes > > int main() { > <- point here > } > > So far so good. Point is correctly indented at column 2 (because > electric-pair-mode has balanced the buffer and electric-indent-mode did > its thing on RET). > > Type 'std'. Nothing surpising happens, good. Now type one ':' and see > the 'std:' be electrically indented to column 1, type the other ':' and > the 'std::' now jumps to column 2 again. > > In bug#62412, Theo said is was OK with killing the custom setting of > electric-indent-chars in c-ts-mode.el and leave it set to the default. > > Though a number of indenting problems would remain after that, at least > this one clear annoyance would be solved. So if there are no > objections, I propose to apply this patch. > > diff --git a/lisp/progmodes/c-ts-mode.el b/lisp/progmodes/c-ts-mode.el > index 59eb9fc23e6..88360716381 100644 > --- a/lisp/progmodes/c-ts-mode.el > +++ b/lisp/progmodes/c-ts-mode.el > @@ -956,10 +956,6 @@ c-ts-base-mode > ;; Comment > (c-ts-common-comment-setup) > > - ;; Electric > - (setq-local electric-indent-chars > - (append "{}():;,#" electric-indent-chars)) > - > ;; Imenu. > (setq-local treesit-simple-imenu-settings > (let ((pred #'c-ts-mode--defun-valid-p)) > > In master? In emacs-29? > > João --1872aa7b243588c28299a1e128 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Thanks. I hadn't gotten around to a recipe yet. How do ot= her editors handle this situation?

On March 28, 2023 18:09:11 Jo=C3=A3o T=C3=A1vora <joao= tavora@gmail.com> wrote:

Jo=C3=A3o T=C3=A1vora <joaotavora@gmail.com> writes= :

I think it's easier that c++-ts-mode doesn't touch that v= ariable at all
and leave it set to "\n".  I can't see it being much= use, with or
without electric-pair-mode in the mix.

Following up on this, I have now tried c++-ts-mode for a = while now and
can confirm this jumping-around-while-typing is terrible = without
electric-pair-mode, and still pretty bad even with electr= ic-pair-mode.

Here's just an example with emacs -Q + electric-pair-mode= + c++-ts-mode

Start typing

i n t SPC m a i n ( ) SPC { RET

The buffer becomes

int main() {
  <- point here
}

So far so good.  Point is correctly indented at colu= mn 2 (because
electric-pair-mode has balanced the buffer and electric-i= ndent-mode did
its thing on RET).

Type 'std'.  Nothing surpising happens, good.  = Now type one ':' and see
the 'std:' be electrically indented to column 1, type the= other ':' and
the 'std::' now jumps to column 2 again.

In bug#62412, Theo said is was OK with killing the custom= setting of
electric-indent-chars in c-ts-mode.el and leave it set to= the default.

Though a number of indenting problems would remain after = that, at least
this one clear annoyance would be solved.  So if the= re are no
objections, I propose to apply this patch.

diff --git a/lisp/progmodes/c-ts-mode.el b/lisp/progmodes= /c-ts-mode.el
index 59eb9fc23e6..88360716381 100644
--- a/lisp/progmodes/c-ts-mode.el
+++ b/lisp/progmodes/c-ts-mode.el
@@ -956,10 +956,6 @@ c-ts-base-mode
   ;; Comment
   (c-ts-common-comment-setup)
 
-  ;; Electric
-  (setq-local electric-indent-chars
-              (append= "{}():;,#" electric-indent-chars))
-
   ;; Imenu.
   (setq-local treesit-simple-imenu-settings
               (l= et ((pred #'c-ts-mode--defun-valid-p))

In master?  In emacs-29?

Jo=C3=A3o

--1872aa7b243588c28299a1e128--