GNU bug report logs -
#62238
30.0.50; Unusual interpretation of "S-expressions" in c-ts-mode
Previous Next
Full log
View this message in rfc822 format
> Cc: 62238 <at> debbugs.gnu.org, Philip Kaludercic <philipk <at> posteo.net>,
> theodor thornhill <theo <at> thornhill.no>
> Date: Sat, 18 Mar 2023 13:11:15 +0100
> From: Daniel Martín via "Bug reports for GNU Emacs,
> the Swiss army knife of text editors" <bug-gnu-emacs <at> gnu.org>
>
> > 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.
I don't understand how you came to that conclusion. Why would we want
to use syntax tables when we have a parser at our fingertips? And if
"the Tree-sitter function is general and should work for every
language", as you say (and I agree), why should we refrain from using
it 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.
There's a huge advantage of using the same function for all the
supported languages, because that makes that function better, as it is
tested in many different situations.
So I don't think I agree with you here, not at all.
This bug report was last modified 2 years and 109 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.