[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: treesit indentation "blinking"
From: |
João Távora |
Subject: |
Re: treesit indentation "blinking" |
Date: |
Sun, 2 Apr 2023 18:23:57 +0100 |
On Sun, Apr 2, 2023 at 6:04 PM Alan Mackenzie <acm@muc.de> wrote:
> > > electric-pair-mode is a user option. We shouldn't be mandating such
> > > things to users, they should be individual choices.
>
> > Fair enough. But so is electric-indent-mode and its electric-indent-chars
> > which are problematic in c++-ts-mode and they _are_ enabled by default.
>
> Yes. Users should be able to chose from amongst these options. They
> shouldn't be "problematic", and that was the point of my last post.
And my point was underlying that electric-indent-chars and electric-indent
mode is currently being "mandated", so to be consistent with your principle
we might as well "mandate" neither of them.
> > electric-pair-mode not only is unproblematic in c++-ts-mode (at least, as
> > far as we know) but is proven to be a good (though not perfect) defense
> > against the real problems posed by the default value of electric-indent-mode
> > and the default value of electric-indent-chars in c++-ts-mode specifically.
>
> It's not a "good defense" for somebody, like me, who doesn't like it.
> It's not good for Emacs for options only to work when distinct other
> options are also enabled.
>
> > So it makes sense to either have both e-p-m and e-i-m or none (or at least
> > less of the second as has been suggested).
>
> Not from a user's point of view. These two modes are wholly independent
> of each other (from that user's point of view), and she should be able
> to enable either or both, as desired, and have them work properly.
But they don't, at least not at the moment. That's a fact.
Of the two modes, one of them is working wholly inaccurately and not doing
any good, and that mode is electric-indent-mode. Because of a combination
of the ambitious value of electric-indent-chars _and_ the underlying
indentation rules problems.
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.
> > At least until the presumed indentation bugs (if in fact they are bugs
> > at all) are fixed (if in fact there is an easy fix for them).
>
> I think it is clear there are bugs here. Electric indentation isn't
> working.
Yes.
If we take c++-mode to be the absolute reference, no it isn't, and
it's unlikely that it ever will. If we take a more modest stance
and think of other editors that don't indent exactly like c++-mode,
then the issue is more subtle.
It's important to state that AFAIK when the buffer is correctly balanced,
c++-ts-mode's indentation is flawless. We're talking about invalid
situations here, and there it's harder to know what the "good" indentation
is, but a nice rule-of-thumb could be "don't do anything". Another
rule would be: do exactly what c++-mode does, but that's a taller order
and I don't think we should be aiming for it.
> > This comparison doesn't make sense to me because in Emacs it's easy to
> > disable it.
>
> But disabling it hits the bugs in electric indentation.
Yes! :-) So you'd tone down electric-indent-chars, but that's been turned
down. So options are disable electric-indent-mode entirely in c++-ts-mode,
enable electric-pair-mode, or live with poor ergonomics in emacs-29
until the bugs are fixed.
João
- Re: treesit indentation "blinking", Yuan Fu, 2023/04/01
- Re: treesit indentation "blinking", Yuan Fu, 2023/04/01
- Re: treesit indentation "blinking", Eli Zaretskii, 2023/04/02
- Re: treesit indentation "blinking", Alan Mackenzie, 2023/04/02
- Re: treesit indentation "blinking", João Távora, 2023/04/02
- Re: treesit indentation "blinking", Alan Mackenzie, 2023/04/02
- Re: treesit indentation "blinking",
João Távora <=
- Re: treesit indentation "blinking", Eli Zaretskii, 2023/04/02
- Re: treesit indentation "blinking", João Távora, 2023/04/02
- Re: treesit indentation "blinking", Eli Zaretskii, 2023/04/02
- Re: treesit indentation "blinking", João Távora, 2023/04/02
- Re: treesit indentation "blinking", Dmitry Gutov, 2023/04/02
- Re: treesit indentation "blinking", João Távora, 2023/04/02
- Re: treesit indentation "blinking", Alan Mackenzie, 2023/04/03
- Re: treesit indentation "blinking", João Távora, 2023/04/03
- Re: treesit indentation "blinking", Dmitry Gutov, 2023/04/03
- Re: treesit indentation "blinking", Alan Mackenzie, 2023/04/03