unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Theodor Thornhill via "Bug reports for GNU Emacs, the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
To: "Daniel Martín" <mardani29@yahoo.es>, "Yuan Fu" <casouri@gmail.com>
Cc: 62238@debbugs.gnu.org, Philip Kaludercic <philipk@posteo.net>
Subject: bug#62238: 30.0.50; Unusual interpretation of "S-expressions" in c-ts-mode
Date: Sat, 18 Mar 2023 14:32:51 +0100	[thread overview]
Message-ID: <D2972437-FC21-481D-A8FE-110DF418CE7A@thornhill.no> (raw)
In-Reply-To: <m15yays1i4.fsf@yahoo.es>



On 18 March 2023 13:11:15 CET, "Daniel Martín" <mardani29@yahoo.es> wrote:
>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.

I tend to agree. I think it works pretty well with java for instance, but I'm struggling with the compound_statement node in the c grammar.

If too much of an annoyance, I'm ok with not defining this for c, but maybe someone that writes more c than me can have a go at defining nodes that makes sense?

Theo





  reply	other threads:[~2023-03-18 13:32 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-17  9:52 bug#62238: 30.0.50; Unusual interpretation of "S-expressions" in c-ts-mode Philip Kaludercic
2023-03-17 17:25 ` Theodor Thornhill via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-03-18  8:00 ` Yuan Fu
2023-03-18 10:29   ` Daniel Martín via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-03-18 12:11     ` Daniel Martín via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-03-18 13:32       ` Theodor Thornhill via Bug reports for GNU Emacs, the Swiss army knife of text editors [this message]
2023-03-18 13:33       ` Eli Zaretskii
2023-03-18 13:41         ` Theodor Thornhill via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-03-18 16:08         ` Daniel Martín via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-03-18 16:29           ` Daniel Martín via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-03-18 17:27           ` Eli Zaretskii
2023-03-19 17:28             ` Juri Linkov
2023-03-19 18:17               ` Eli Zaretskii
2023-03-20 18:13                 ` Juri Linkov
2023-03-29 16:46                   ` Juri Linkov
2023-03-18 10:31   ` Kévin Le Gouguec
2023-03-18 17:48     ` Dmitry Gutov
2023-03-18 18:00       ` Theodor Thornhill via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-03-18 21:34     ` Yuan Fu

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=D2972437-FC21-481D-A8FE-110DF418CE7A@thornhill.no \
    --to=bug-gnu-emacs@gnu.org \
    --cc=62238@debbugs.gnu.org \
    --cc=casouri@gmail.com \
    --cc=mardani29@yahoo.es \
    --cc=philipk@posteo.net \
    --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).