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: Sat, 25 Mar 2023 16:18:57 +0000
User-agent: Gnus/5.13 (Gnus v5.13)

Eli Zaretskii <eliz@gnu.org> writes:

>> Date: Sat, 25 Mar 2023 14:42:50 +0200
>> Cc: Daniel Colascione <dancol@dancol.org>, Yuan Fu <casouri@gmail.com>,
>>  emacs-devel@gnu.org
>> From: Dmitry Gutov <dgutov@yandex.ru>
>> 
>> > I don't think this problem has anything to do with tree-sitter.  It
>> > would happen just as well in regular c++-mode if electric-indent-mode
>> > were on by default there (but it isn't).
>> 
>> The mode is globally on by default, but indeed the contents of 
>> electric-indent-chars are much shorter there.
>> 
>> > So it's just the fact that electric-indent-mode is on by default
>> > _and_ c-ts-mode.el does this:
>> > 
>> > (setq-local electric-indent-chars (append "{}():;,#" 
>> > electric-indent-chars))
>> > 
>> > so people are getting what the mode author (and Emacs defaults) ask for:
>> > electric indentation doing its thing.
>> 
>> Good point: perhaps either this list should be revisited, or predicated 
>> (at runtime) somehow on electric-pair-mode being enabled.
>
> Maybe the list of electric characters should be a defcustom?

Maybe, but then major-modes like c++-ts-mode shouldn't mess with it.  Or
do you mean a electric-indent-chars-for-c++-ts-mode-specifically
defcustom.  If so, that's a bit odd.  What if the user then also wants
to set electric-indent-chars herself?

I think it's easier that c++-ts-mode doesn't touch that variable at all
and leave it set to "\n".  I can't see it being much use, with or
without electric-pair-mode in the mix.

João



reply via email to

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