From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: =?UTF-8?B?Sm/Do28gVMOhdm9yYQ==?= Newsgroups: gmane.emacs.devel Subject: Re: treesit indentation "blinking" Date: Wed, 29 Mar 2023 22:30:29 +0000 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> 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="13822"; 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: Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Thu Mar 30 00:29:50 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 1pheIf-0003NY-RX for ged-emacs-devel@m.gmane-mx.org; Thu, 30 Mar 2023 00:29:49 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pheHg-0000Nr-3B; Wed, 29 Mar 2023 18:28:48 -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 1pheHe-0000NN-3V for emacs-devel@gnu.org; Wed, 29 Mar 2023 18:28:46 -0400 Original-Received: from mail-oo1-xc2c.google.com ([2607:f8b0:4864:20::c2c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pheHc-0007EV-I0; Wed, 29 Mar 2023 18:28:45 -0400 Original-Received: by mail-oo1-xc2c.google.com with SMTP id p2-20020a056820044200b0053e5914a50fso1432971oou.2; Wed, 29 Mar 2023 15:28:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1680128922; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=eEMbGBiZZcBHBKalRx0md9mQ6dovFZCC7D34V9Vj2RQ=; b=qVbyIRXImjxlaCWOSxMEvoDPZCi2IYMvTw6ZvVXbLwwiPH+H4BGzPdSgdOv+zUEPd2 lSBspspjj1WC8DB343bu1dv2xlF6Nxnr63MxKksWDHLWHF1m148YhN0UtvJKGH1PUre1 0Jnh8yxWZrP1W56j0tM1LfHUTde4n5S/kSN+sMlP8TJ+wD9oBIHkDMeGLCMNxBwEv/zQ zSmXKniCUR+D24TWP8b2Ez54P3wTDST3bzMa1tcgMN13ltOH9XUBglIbirMaxS55m40R bx9RcILVl30w/24ucBVAy5k5qgN2J/7Nku3stKFRt4EKUNPi/lGrQKBPUsWqvjVe0mDt lr/A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1680128922; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=eEMbGBiZZcBHBKalRx0md9mQ6dovFZCC7D34V9Vj2RQ=; b=1ZY9BZWhT5dYPRli2oIvQltiMQbNU40YT2syL12Rj5v/eDXU3jjEXdzSNAbGvCO8RC PiKT7d+lrgYag76MA3EhaOTrjX7SYBgEQKvUoZEQG/ecBAkMzH3iNEI4yfhMoYjoNzi7 22evxpd7MCnNqShI5qrRj7924WX9NcAtmErNMCT3T2RcMwI0JRhrbAT0Zv9g0U6ePHpy 8O6wNP+bbMigpBP+kNdwyWQQUz1jabUu0unaAhwhIqPaY4be8EMQs6OHjydepdPBL8gX glf01Ve1GAtRD7OjlAat0zANoAlIQ4CBF7KMc/nB7GZGvEG3/5ToajSL/RAv5fFjqgxn ZzsA== X-Gm-Message-State: AO0yUKXPGXvvEl9KGPE3CZI5K6MVq77tukQZzKlqL9wKd04Ci2fXCDH5 K7gPpTXLYbEdMR33yr45F45N87DTISlS16aKKt25XNpd X-Google-Smtp-Source: AK7set+MCgctzjyGO85Sr0hi9EEsgQob61hYgCIzZ5XJ5r8N4OtW3PbanYz5IsjHDhUlNEUchEQrZ9YX94Hz3h1HGzc= X-Received: by 2002:a4a:c995:0:b0:53a:9f38:3170 with SMTP id u21-20020a4ac995000000b0053a9f383170mr7537116ooq.1.1680128921901; Wed, 29 Mar 2023 15:28:41 -0700 (PDT) In-Reply-To: <83pm8s70o3.fsf@gnu.org> Received-SPF: pass client-ip=2607:f8b0:4864:20::c2c; envelope-from=joaotavora@gmail.com; helo=mail-oo1-xc2c.google.com X-Spam_score_int: -10 X-Spam_score: -1.1 X-Spam_bar: - X-Spam_report: (-1.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, FREEMAIL_REPLY=1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no 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:304828 Archived-At: On Wed, Mar 29, 2023 at 3:26=E2=80=AFAM Eli Zaretskii wrote: > > > From: Jo=C3=A3o T=C3=A1vora > > Cc: Dmitry Gutov , dancol@dancol.org, casouri@gmail= .com, > > emacs-devel@gnu.org, theo@thornhill.no > > Date: Tue, 28 Mar 2023 23:11:05 +0100 > > > > 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? > > 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. So I won't do that change myself. > I'm also interested to know what other editors do, as Daniel points > out. I don't use many other editors but I can tell you that online editors like the ones found at hackerrank.com, which I strongly suspect are based on LSP + treesitter behave as if electric-pair-mode was on and electric-indent-chars is just '(?\n). I.e. they auto-indent on newline and don't bounce around when symbols such as ':',')' or ';' are typed. As far as I can tell, auto-indenting on characters other than newline is an Emacs invention that only works well if a mode has near-perfect predictive powers of indentation, which c++-ts-mode clearly doesn't have (yet). 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. Jo=C3=A3o