unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Yuan Fu <casouri@gmail.com>
To: geza.herman@gmail.com
Cc: 62412@debbugs.gnu.org, theodor thornhill <theo@thornhill.no>
Subject: bug#62412: 29.0.60; strange c++ indentation behavior with tree  sitter
Date: Fri, 24 Mar 2023 11:17:28 -0700	[thread overview]
Message-ID: <2496F2A0-3EB1-4CD2-B299-E1DC41B7C23B@gmail.com> (raw)
In-Reply-To: <41859726-8f6d-c8d9-5a56-b0c98c153391@gmail.com>


"Herman, Geza" <geza.herman@gmail.com> writes:

> Copy this half-written program to a c++-ts-mode buffer:
>
> ----- 8< -----------------------
>
> void foo() {
>   for (int i=0
> }
>
> int main(int argc, char *argv[]) {
> }
>
> ----- 8< -----------------------
>
> Move the point to the end of the line of the for loop, and press ";"
> (as if you continued to write the loop). Notice that the line will
> lose its indentation ("for" will be moved to column 1). If you
> continue writing the for loop, it will be correctly re-indented after
> the closing parenthesis (for example, continue the line with "; i<10;
> i++)", and notice that after pressing ")", the line will be
> re-indented).
>
> This doesn't happen if the main function is deleted. I'm not sure
> whether this is a tree-sitter or emacs problem, but I reported here
> because I think it's more likely that this is some emacs problem.

I believe this is due to this rule:

((query "(ERROR (ERROR)) @indent") column-0 0)

I’m not sure about the original purpose for this rule, CC’ing Theo.

Yuan





  reply	other threads:[~2023-03-24 18:17 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 [this message]
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
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

  List information: https://www.gnu.org/software/emacs/

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

  git send-email \
    --in-reply-to=2496F2A0-3EB1-4CD2-B299-E1DC41B7C23B@gmail.com \
    --to=casouri@gmail.com \
    --cc=62412@debbugs.gnu.org \
    --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 public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).