From: Stefan Kangas <stefankangas@gmail.com>
To: Yuan Fu <casouri@gmail.com>
Cc: Eli Zaretskii <eliz@gnu.org>,
theodor thornhill <theo@thornhill.no>,
geza.herman@gmail.com, 62302-done@debbugs.gnu.org
Subject: bug#62302: 30.0.50; c/c++ tree sitter forward-sexp problem
Date: Tue, 5 Sep 2023 16:50:10 -0700 [thread overview]
Message-ID: <CADwFkmmdJSUxBUpUwdd2bbNcviot1Bb_AdULr+6tcpENaSdKLQ@mail.gmail.com> (raw)
In-Reply-To: <A0F0E256-AAC8-460A-8348-045752BE1081@gmail.com> (Yuan Fu's message of "Thu, 6 Apr 2023 14:55:11 -0700")
Yuan Fu <casouri@gmail.com> writes:
> Eli Zaretskii <eliz@gnu.org> writes:
>
>>> Date: Mon, 20 Mar 2023 21:40:26 +0100
>>> From: "Herman, Geza" <geza.herman@gmail.com>
>>>
>>> With tree sitter, forward-sexp behaves a little strange. To reproduce:
>>> - copy the little example program below into a c++-ts-mode buffer
>>> - move the point to the opening curly brace of "main() {"
>>> - M-x forward-sexp
>>>
>>> This will move the point to the space character in "int a;". But without
>>> tree sitter, this moves the point to the closing brace of main (I
>>> believe this is the correct behavior).
>>>
>>> I noticed this problem because hideshow behaves strangely with tree sitter:
>>> - enable hideshow mode (M-x hs-minor-mode)
>>> - move the point to the same opening brace
>>> - M-x hs-toggle-hiding
>>>
>>> Hideshow should hide the whole body of main, but instead it only hides
>>> parts of the body, and the buffer ends up like this:
>>>
>>> int main() {... a;
>>> }
>>> int b;
>>> }
>>>
>>> If I set forward-sexp-function to nil, the problem goes away. I think
>>> this issue is somewhat related to #60894
>>>
>>> Here's the little example program:
>>>
>>> int main() {
>>> if (false) {
>>> int a;
>>> }
>>> int b;
>>> }
>>
>> Theo, Yuan: any comments? Can you look into fixing this?
>>
>> Thanks.
>
> Missed this, sorry :-)
>
> I modified the definition of "sexp" in c/c++-ts-mode. I think new
> definition is intuitive but only time will tell. The new definition
> works on the little example in this report.
>
> Yuan
It seems like this has been fixed, so I'm closing this bug report.
prev parent reply other threads:[~2023-09-05 23:50 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-20 20:40 bug#62302: 30.0.50; c/c++ tree sitter forward-sexp problem Herman, Geza
2023-04-06 10:12 ` Eli Zaretskii
2023-04-06 21:55 ` Yuan Fu
2023-09-05 23:50 ` Stefan Kangas [this message]
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=CADwFkmmdJSUxBUpUwdd2bbNcviot1Bb_AdULr+6tcpENaSdKLQ@mail.gmail.com \
--to=stefankangas@gmail.com \
--cc=62302-done@debbugs.gnu.org \
--cc=casouri@gmail.com \
--cc=eliz@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).