From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Dmitry Gutov Newsgroups: gmane.emacs.devel Subject: Re: treesit indentation "blinking" Date: Tue, 4 Apr 2023 01:10:49 +0300 Message-ID: <07816781-f9d5-282c-56ae-6ef941f0241f@yandex.ru> References: <83bkka5z7w.fsf@gnu.org> <871ql6a4d4.fsf@gmail.com> <83jzyy4776.fsf@gnu.org> <9F152CAA-6326-459F-84FF-87988B3A92B6@gmail.com> <6bf0322b-1151-129a-e26f-61cf4f232d17@yandex.ru> <6efb9f84-211d-560e-3196-95d7f0b8be19@yandex.ru> <1874921e1d0.2829.cc5b3318d7e9908e2c46732289705cb0@dancol.org> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="27132"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.9.0 Cc: =?UTF-8?B?Sm/Do28gVMOhdm9yYQ==?= , Yuan Fu , Eli Zaretskii , theodor thornhill , geza.herman@gmail.com, emacs-devel@gnu.org To: Daniel Colascione , Alan Mackenzie Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Tue Apr 04 00:13:02 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 1pjSQ9-0006sN-Ak for ged-emacs-devel@m.gmane-mx.org; Tue, 04 Apr 2023 00:13:01 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pjSPR-0005JK-GX; Mon, 03 Apr 2023 18:12:17 -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 1pjSPF-0005D6-IR for emacs-devel@gnu.org; Mon, 03 Apr 2023 18:12:05 -0400 Original-Received: from mail-wm1-x32c.google.com ([2a00:1450:4864:20::32c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pjSO7-000208-B8; Mon, 03 Apr 2023 18:12:05 -0400 Original-Received: by mail-wm1-x32c.google.com with SMTP id hg25-20020a05600c539900b003f05a99a841so1008813wmb.3; Mon, 03 Apr 2023 15:10:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1680559852; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :sender:from:to:cc:subject:date:message-id:reply-to; bh=3WZTKpBJTHXuahT3teb/qcOy0FrO6TbwydibVyPGNLo=; b=YoWp7ctw9Bc3ZQltSEi3c99ztFAuY7d5+WMfE0KY+PJ7lC06nNwfA4Vo/0njuiFc4h f2TAloA1mU4WN+t6GYyoCdBIJcMkiFut4cfubsdtje621K+tw71l2NNTzL/9rWK2+GYP O506BtPmiJshL9nZnf0zPaJprKmKNT8pCApLKGZbHAJtSlI03mnrklv02OMv94BhTHNB JWL+ZfowEUAOJ5XX4XWlDLaUqT/lHLX/epwDEKLcYJpVR+a1hjvr6PDbWvgUpjCnjY96 JMHiysQmZ7WhB1bqjaiMRgVn/Ujjp6VCWiCVk+xEgNRyGgumm8UKLIXHdpNsrH7qqZsf Y+gQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1680559852; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :sender:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=3WZTKpBJTHXuahT3teb/qcOy0FrO6TbwydibVyPGNLo=; b=vfMElcSobZ8sZ40vYT/L9sxA8pMQsUa2aLfImF+mH4zrwEGY2cKKm1QNe4YlAAb7XY wcFuXV4rLNQKypPxL68U9eC680LXrl5lSSY5MpHEzxKjBpfJebehJ0kbJtJ6JXJnNxDr /dE/wq5d2TraUwi03U7PYvjnU90fIBnNWVBk8Q6/NkTqVdoGcmif1QnZDsZnRAfRkbNE glDWOcJAnK9JEuVCnatDMtUALqoP5y5/pDwMW9Jur24hRfVfX6ZY1qVcmtFvdVvYAMU+ +62fYrdE0M0N4bqSD9Ceobb9rtNjgw6Kje0NJJHZyeXZIZI8fVTg/6N3UjtkZtkMA7hU UUZA== X-Gm-Message-State: AAQBX9f3d2WPvx7NaNna6p5HEcPGLQvEGsWNqsCX+hkZyWt0N+2ujXo2 8dEcq0eTWsjhcQoS9+X5nXM= X-Google-Smtp-Source: AKy350Y8dPrZz6wTkPadnZYspcuJVsTlL3pq/QR1hlu8ab6DPR5yo15zPzFdMpOxpU1ED7qky4Q/jA== X-Received: by 2002:a05:600c:2303:b0:3f0:4734:bef8 with SMTP id 3-20020a05600c230300b003f04734bef8mr545293wmo.39.1680559852215; Mon, 03 Apr 2023 15:10:52 -0700 (PDT) Original-Received: from [192.168.1.2] ([31.216.80.60]) by smtp.googlemail.com with ESMTPSA id u14-20020a05600c210e00b003f04785699asm10020634wml.43.2023.04.03.15.10.50 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 03 Apr 2023 15:10:51 -0700 (PDT) Content-Language: en-US In-Reply-To: <1874921e1d0.2829.cc5b3318d7e9908e2c46732289705cb0@dancol.org> Received-SPF: pass client-ip=2a00:1450:4864:20::32c; envelope-from=raaahh@gmail.com; helo=mail-wm1-x32c.google.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.249, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.25, NICE_REPLY_A=-1.349, 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:305089 Archived-At: On 04/04/2023 00:59, Daniel Colascione wrote: > On April 3, 2023 08:07:17 Dmitry Gutov wrote: > >> On 03/04/2023 12:59, Alan Mackenzie wrote: >>> Hello, Dmitry. >>> >>> On Mon, Apr 03, 2023 at 00:21:18 +0300, Dmitry Gutov wrote: >>>> On 02/04/2023 20:23, João Távora wrote: >>>>> So my initial idea was to tone down electric-indent-chars, at least >>>>> for the moment.  And Dmitry's idea was to make electric-indent-chars >>>>> be ambitious_only_  if electric-pair-mode is enabled (by the user). >>>>> Maybe we should bring back that idea, and it seems the least bad of the >>>>> bunch right now. >>> >>>> Alternatively, we only perform "electric indent" (aside from after RET) >>>> when the parse tree does not contain errors. >>> >>> That is NOT electric indentation.  The whole point about electric >>> indentation is for it to take effect whilst point is still on the line >>> being edited.  Thus, for example, you can see whether or not the line >>> needs breaking, or whether there's room for a short comment at the end >>> of the line. >> >> Wouldn't you know whether the line needs breaking, as long as the line >> was indented correctly when you opened it with RET? >> >>> What you're proposing is something which would almost never trigger, >>> since a line being edited will not have a parse tree without errors (if >>> I've understood that properly).  If it did trigger at some point, that >>> would likely cause annoyance and puzzlement. >> >> That's a fair assessment, but it's going to trigger in a lot of cases >> still: after ;, or after a paren or brace being closed. > > Silly question: can't we make a mode with c++-mode's indentation (and > folding etc.) and c++-ts-mode's fontification? Such a thing would also > preserve compatibility with the numerous ad hoc c++-mode styles out there. Sure, we could: inherit from c++-mode and add then add most of c++-ts-mode's definition, just without indent-related variables. python-ts-mode is an example of such mode. Whatever performance complaints people had about c++-mode, though, those will stay around, and perhaps get a little bit worse due to additional work of maintaining the tree-sitter parse tree. And at least some of CC Mode's latest bug reports related to problems "parsing" the code (in the way that CC Mode does that). Such problems would be harder to spot when using the new hybrid mode because they won't affect syntax highlighting, but they could still affect indentation.