bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#62238: 30.0.50; Unusual interpretation of "S-expressions" in c-ts-mo


From: Daniel Martín
Subject: bug#62238: 30.0.50; Unusual interpretation of "S-expressions" in c-ts-mode
Date: Sat, 18 Mar 2023 13:11:15 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.2 (darwin)

Daniel Martín <mardani29@yahoo.es> writes:

> Yuan Fu <casouri@gmail.com> writes:
>
>>
>> I tested this on my Emacs session and vanilla session, and both marked
>> to the closing bracket. I believe forward-sexp should just work by the
>> syntax table. Perhaps it’s your config or something?
>>
>
> You need to enable c-ts-mode first, which redirects
> forward-sexp-function to treesit-forward-sexp.

I see in treesit.el that we set forward-sexp-function to
treesit-forward-sexp when treesit-sexp-type-regexp is set by the major
mode.  For languages with simple grammars, like C, I think that the
current approach that uses the syntax table is simpler and less prone to
errors, because the Tree-sitter function is general and should work for
every language.  I'd suggest we don't define treesit-sexp-type-regexp in
c-ts-mode, at least for C.

For languages like TypeScript, whose grammar is more complex, perhaps
forward-sexp does not work very well and using Tree-sitter to implement
it gives better results with code that is simpler to understand.

Thanks.




reply via email to

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