GNU bug report logs - #62412
29.0.60; strange c++ indentation behavior with tree sitter

Previous Next

Package: emacs;

Reported by: "Herman, Geza" <geza.herman <at> gmail.com>

Date: Thu, 23 Mar 2023 20:44:02 UTC

Severity: normal

Found in version 29.0.60

Done: Stefan Kangas <stefankangas <at> gmail.com>

Bug is archived. No further changes may be made.

Full log


Message #17 received at 62412 <at> debbugs.gnu.org (full text, mbox):

From: Theodor Thornhill <theo <at> thornhill.no>
To: João Távora <joaotavora <at> gmail.com>
Cc: Yuan Fu <casouri <at> gmail.com>, 62412 <at> debbugs.gnu.org, geza.herman <at> gmail.com
Subject: Re: bug#62412: 29.0.60; strange c++ indentation behavior with tree sitter
Date: Sat, 25 Mar 2023 11:19:36 +0100

On 25 March 2023 09:53:31 CET, "João Távora" <joaotavora <at> gmail.com> wrote:
>On Fri, Mar 24, 2023 at 10:02 PM Theodor Thornhill via Bug reports for
>GNU Emacs, the Swiss army knife of text editors
><bug-gnu-emacs <at> gnu.org> wrote:
>e about the original purpose for this rule, CC’ing Theo.
>> >
>> >Yuan
>> I'll look more deeply into the cause of this, but the rule is covering some preproc directives iirc.
>>
>> Unfortunately tree-sitter behaves better when auto pairs is used. I would advise people to use electric-pairs-mode (if that's the correct name, on mobile now) to avoid these sorts of issues.
>
>electric-pair-mode, it's not on by default.
>
>But, for some reason, electric-indent-mode _is_ on by default,
>at least in c++-ts-mode.
>
>So this has nothing to do with tree-sitter IMO, it's just
>electric-pair-mode doing its thing.
>
>Why is it on by default?  A fair number of users don't like
>this electricity, or prefer to have it toned down.  At least
>this has been the  argument for not turning on electric-pair-mode
>by default, which is a much less jarring mode IMO, and one which
>would solve these problems.
>
>João

Yeah, maybe! But I was under the impression that indentation was electric by default in most modes, but I may be mistaken.

The reason I mentioned electric-pair-mode is that the parser fails less often when the closing paren or bracket is inserted, as it is much simpler to have a functional ast.




This bug report was last modified 1 year and 313 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.