GNU bug report logs - #62238
30.0.50; Unusual interpretation of "S-expressions" in c-ts-mode

Previous Next

Package: emacs;

Reported by: Philip Kaludercic <philipk <at> posteo.net>

Date: Fri, 17 Mar 2023 09:53:01 UTC

Severity: normal

Found in version 30.0.50

Full log


Message #29 received at 62238 <at> debbugs.gnu.org (full text, mbox):

From: Theodor Thornhill <theo <at> thornhill.no>
To: Eli Zaretskii <eliz <at> gnu.org>,
 Daniel Martín <mardani29 <at> yahoo.es>
Cc: 62238 <at> debbugs.gnu.org, casouri <at> gmail.com, philipk <at> posteo.net
Subject: Re: bug#62238: 30.0.50; Unusual interpretation of "S-expressions" in c-ts-mode
Date: Sat, 18 Mar 2023 14:41:57 +0100

On 18 March 2023 14:33:49 CET, Eli Zaretskii <eliz <at> gnu.org> wrote:
>> 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.

Yeah but I need some more time, or at least some patches to look at :)

Theo




This bug report was last modified 2 years and 80 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.