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 10:43:47 +0300 Message-ID: <83mt3u65vw.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> 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="27520"; mail-complaints-to="usenet@ciao.gmane.io" Cc: dgutov@yandex.ru, dancol@dancol.org, casouri@gmail.com, emacs-devel@gnu.org, theo@thornhill.no To: =?utf-8?B?Sm/Do28gVMOhdm9yYQ==?= Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Thu Mar 30 09:44:57 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 1phmxt-0006rB-5H for ged-emacs-devel@m.gmane-mx.org; Thu, 30 Mar 2023 09:44:57 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1phmx0-0003Tf-An; Thu, 30 Mar 2023 03:44:02 -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 1phmwx-0003TP-Vt for emacs-devel@gnu.org; Thu, 30 Mar 2023 03:44: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 1phmww-0003P6-4Q; Thu, 30 Mar 2023 03:43: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=aboFSum6cnAImqQ3ojZmFRKUQitJ3DnnTDVnOIfvb2A=; b=aqrktU2Ycx6AOzYwWO+c Sl5gafM42Cu7ntrdWIK395cyx1FmqqW1am8yTb9jZVqXbSWU5GzFWBRM/VCheycjOSFjb8b735azi HBewXvxMf3/PMYiU4KZaPDRwEmIbyf8GsGXAMg3ZqEfo8rk1BKUb1HZ30kucePKTPI+DSVRogxFRF p7s5eJzEyS2aOo6NRzgma4k5MOSV0xsOUwazhQHPewI4S8Yk5O81mJMCh8X5R+yPPPETltmKv1zmN oLzYokMhsmSjhYBuaVkwsvwfxyrreUWD+8tzGJDN4LfWAANydyU3gPXQFfC187RtmOCGPWQ3528nr ZGdjk2iVQ7Djow==; 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 1phmwb-0008Gp-UW; Thu, 30 Mar 2023 03:43:47 -0400 In-Reply-To: (message from =?utf-8?B?Sm/Do28gVMOhdm9yYQ==?= on Wed, 29 Mar 2023 22:30:29 +0000) 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:304837 Archived-At: > From: João Távora > Date: Wed, 29 Mar 2023 22:30:29 +0000 > Cc: dgutov@yandex.ru, dancol@dancol.org, casouri@gmail.com, > emacs-devel@gnu.org, theo@thornhill.no > > > > 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? > > > > I suggest to do this in emacs-29, but conditionally, with a > > defcustom. This will allow users to try both ways and maybe we will > > have some feedback regarding what is the best way. > > I'm not fond of creating a defcustom to work around what I consider > as a simple bug and to configure something which the user can already > configure with a two-line mode hook addition. I think this conclusion is at least inaccurate, if not incorrect. IOW, this is not "a simple bug", it could be an issue with different personal preferences or something else. See below for details. > So I won't do that change myself. That's a strange stance. Discussion of solutions to issues can legitimately conclude that some solution could be subject to personal preferences, some of which you don't share. Refusing to install a change you yourself suggested with such minor adjustments, just because it doesn't fit your personal preferences in editing C/C++ code, sounds at least unfriendly. > And then my personal opinion is that it is an annoying > feature to have on by default as it whole lines about. > Having electric-indent-chars set to '(?\n), like c++-mode > has, is fine. Let's back up a notch and revisit the evidence, okay? First, I don't agree with your conclusion that the local setting of electric-indent-chars in c-ts-base-mode causes divergent behavior wrt its CC mode equivalents. In particular, the example you brought up in https://lists.gnu.org/archive/html/emacs-devel/2023-03/msg00939.html behaves the same in c++-mode, at least in "emacs -Q": "std:" (with a single colon) causes reindentation as if this were a label, and adding another colon indents back to column 2. So at least in this example the behavior I see is the same in both modes. Also, at least some of the examples for a different behavior between c++-mode and c++-ts-mode explicitly turned OFF electric-indent-mode. For example, see https://debbugs.gnu.org/cgi/bugreport.cgi?bug=62412#14 When electric-indent-mode is turned OFF, setting electric-indent-chars cannot possibly make any difference, right? (Btw, I cannot reproduce what the first example there says: if I turn OFF electric-indent-mode, RET doesn't correctly indent the next line; instead, the next line is not indented at all. So I wonder what is being missed here.) More generally, the claim that CC mode doesn't alter electric-indent-chars doesn't really explain the differences in behavior, because while the claim is factually true, CC mode gives some characters electric behavior that is independent of electric-indent-chars, see the node "Electric Keys" in the CC Mode manual. What happens here is that keys like '#', '*', '<', '(', '{', ':', and others are bound to CC mode specific commands like c-electric-pound and c-electric-brace, which reindent the code if electric-indent-mode is turned on in the buffer. Bottom line: I think both this thread and the discussion in bug#62412 have a lot of misunderstandings and examples at least I cannot reproduce, and therefore the conclusions reached there, including your suggestion to remove addition to electric-indent-chars, might very well be based on those misunderstandings and/or unreproducible results. Therefore, to make progress in this issue, we should revisit the examples, decide whether we are discussing behavior with or without electric-indent-mode, and then take this from there, after making sure we are on the same page. For now, I see no reason to remove the line in c-ts-base-mode which adds to electric-indent-chars, with or without a defcustom to control that.