all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: "João Távora" <joaotavora@gmail.com>
To: Herman@debbugs.gnu.org, Géza <geza.herman@gmail.com>
Cc: Yuan Fu <casouri@gmail.com>,
	Theodor Thornhill <theo@thornhill.no>,
	62412@debbugs.gnu.org
Subject: bug#62412: 29.0.60; strange c++ indentation behavior with tree sitter
Date: Sat, 25 Mar 2023 16:23:35 +0000	[thread overview]
Message-ID: <87o7ogx0jc.fsf@gmail.com> (raw)
In-Reply-To: <72d72cd6-4fa8-2df3-f45d-5bf5845e4f38@gmail.com> ("Herman, Géza"'s message of "Sat, 25 Mar 2023 14:48:05 +0100")

"Herman, Géza" <geza.herman@gmail.com> writes:

> On 3/25/23 12:43, João Távora wrote:
>>
>> There can be no "correct" indentation in a buffer with an invalid state.
>>
>> But there are heuristics.  Here, it can be argued that c++-mode's
>> heuristics are better.
> I agree. In my opinion, c++-mode's heuristics are good.

That's probably only because we're _used_ to c++-mode.  If we had been
using c++-ts-mode for years, we would be equally suprised.

> Tree-sitter support is new, it's expected that it won't work
> perfectly. Also, it doesn't have to handle any invalid program. But,
> while writing a program, it should handle indentation sensibly. I
> don't think that it's a good approach that everybody who uses electric
> indent should get used to the fact that whenever they writing a for
> loop, the line will jump around. It's a bad experience.

But writing a for loop from scratch is only one of the editing
activities you do in a C++ file.  Other activities involve editing
existing code.  In those situations, c++-ts-mode's heuristics could
"win".  Unless you're willing to posit that writing code from scratch is
more frequent than editing existing code, there's no right answer here.

> Anyways, feel free to close this issue if you think otherwise. I just
> disabled ';'-caused auto indenting, so I don't see this unpleasant
> behavior any more.

Yes, i'm inclined to think that c++-ts-mode shouldn't add any chars to
electric-indent-chars.  It's just not useful.

João





  reply	other threads:[~2023-03-25 16:23 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-23 20:43 bug#62412: 29.0.60; strange c++ indentation behavior with tree sitter Herman, Geza
2023-03-24 18:17 ` Yuan Fu
2023-03-24 20:04   ` Theodor Thornhill via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-03-25  8:53     ` João Távora
2023-03-25 10:19       ` Theodor Thornhill via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-03-25 10:28         ` João Távora
2023-03-25 10:26       ` Herman, Géza
2023-03-25 11:43         ` João Távora
2023-03-25 13:48           ` Herman, Géza
2023-03-25 16:23             ` João Távora [this message]
2023-03-25 17:41               ` Theodor Thornhill via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-09-12  0:03                 ` Stefan Kangas
2023-03-25 17:47               ` Herman, Géza
2023-03-25 17:53                 ` João Távora
2023-03-26 13:54           ` Herman, Géza
2023-03-26 13:25     ` Daniel Martín via Bug reports for GNU Emacs, the Swiss army knife of text editors

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87o7ogx0jc.fsf@gmail.com \
    --to=joaotavora@gmail.com \
    --cc=62412@debbugs.gnu.org \
    --cc=Herman@debbugs.gnu.org \
    --cc=casouri@gmail.com \
    --cc=geza.herman@gmail.com \
    --cc=theo@thornhill.no \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.