emacs-devel
[Top][All Lists]
Advanced

[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: Thu, 30 Mar 2023 12:05:35 +0100
User-agent: Gnus/5.13 (Gnus v5.13)

Eli Zaretskii <eliz@gnu.org> writes:

> What _is_ unfriendly is to refuse to install a change that you
> yourself consider required, when asked to do that conditionally, so
> users who still want the electricity, even though it "blinks", could
> still have it.  I think the request is reasonable, especially since
> you don't use this mode, and so can easily overlook some useful
> behavior that your proposed change could disable or break.

You don't need me to install changes, do you?  It's not like I'm
refusing to fix a bug that I added: I didn't write any of this.  Users
that do (or don't) want electricity already have good ways to fine-tune
that preference.  I don't think this particular idea of your is very
good, so I politely stated I'd rather not work on that possibility.  If
someone does, I won't object.  I think that's friendly enough.

>> I didn't realize that, because I use c++-mode with its electric features
>> off.
>
> If you turn electric features off, then electric-indent-chars will
> have no effect whatsoever, and all this discussion is moot.

No.  I use c++ mode with its bindings like c-electric-paren deactivated.
I still use electric-indent-mode with its very reasonable default value
for of (?\n)

>> I think within 5 minutes of editing, someone used to c++-mode -- even
>> with its default electricity -- will start to feel unconfortable with
>> c++-ts-mode.
>
> We shall see, okay?  You could be right or you could be wrong.  The
> purpose of releasing these modes in Emacs 29 is to collect user
> feedback, so we know in which direction(s) to develop them further.
> Your opinions are noted, but let's give others chance to voice theirs,
> okay?

I find this suggestion that I'm somehow shooshing other's opinions.  So
far I don't think anyone here has said they _like_ the bouncing.  But
maybe someone does..  I wasn't even the first to report this.  Daniel
did in this list and Geza Herman did in #61412.

> The above message as part of bug#62412 clearly says "Let's assume you
> turn off electric-indent-mode."  I interpreted that as meaning that
> electric-indent-mode is to be turned off for the rest of the examples
> to do what you mean them to do.

I see, my bad.  Should have written electric-pair-mode instead.

>> I already gave this alternative MRE of bouncing behaviour.
>> 
>>    emacs -Q `mktemp`.cpp -f c++-ts-mode  
>> 
>>    i n t SPC m a i n ( ) { RET for ( ; ; ) SPC b l a ( ) ;  
>> 
>> Can you reproduce this bouncing?
>
> No, I cannot.  All I see is that the semi-colon after "foo()" indents
> the line, just once, so that it has the correct indentation
> (previously it had no indentation at all).

We have different ideas of bouncing.

>> Now try the same with c++-mode. Do you confirm that it doesn't
>> bounce?
>
> The only difference I see is that c++-mode indents the line with "for"
> right from the start, after I type RET.  Which is better indeed, but
> what c++-ts-mode does is not a catastrophe, either.

Never said it's a "catastrophe".  Just annoying/jarring/suprising
behaviour that you don't get with vanilla c++-mode or modes based on
cc-mode.  I think that electric-indent-chars was designed with those
modes in mind.

>> Also in c++-ts-mode, add a closing `}`.  See the "mismatched
>> parenthesis"?
>
> No, I don't.
> Are you using Emacs 29 or Emacs 30?  I'm using the former.

I'm using the latest master (560c27a3) and starting it with 

src/emacs -Q `mktemp`.cpp -f c++-ts-mode

> Also, which version of the tree-sitter C++ grammar library do you have
> installed?

I don't know how to answer that.  I used M-x
treesit-install-language-grammar RET "cpp" and accepted the default in
all prompts.  I presume it installs the latest version of the Git repo.
I've just reinstalled today.

I have ~/.emacs.d/tree-sitter/libtree-sitter-cpp.so I don't think it
stores the version number there.

>> Now I'm going to give another example.  In the same file, go back to
>> c++-ts-mode.  Say you spotted a mistake and dont want an infloop after
>> all.  Go and delete the two ';;' in the for expressions, leaving, say
>> just the parenthesis.  Start typing another set of expressions.
>
> Please state exactly what to type, otherwise we will again be talking
> past each other.

You can _see_ in the GIF what I type.  I've just using normal keys for
self-insert.  Then C-p, and some C-f to position my cursor before the
';;', then C-d to delete the two ';;'. And then add them back again with
two ';;'.  After the first ';' the line goes back, then the second one,
and the line goes forward ';'.

Just confirmed it happens in Emacs 29 too, commit
d2e82817a3f341e426c220e98048e1784d1e3076.

Also see the original recipe of bug#62142, which is quite easy to
follow, for more bouncing.  Can't you reproduce this either?

João



reply via email to

[Prev in Thread] Current Thread [Next in Thread]