all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: "Daniel Martín" <mardani29@yahoo.es>
Cc: 62238@debbugs.gnu.org, casouri@gmail.com, theo@thornhill.no,
	philipk@posteo.net
Subject: bug#62238: 30.0.50; Unusual interpretation of "S-expressions" in c-ts-mode
Date: Sat, 18 Mar 2023 19:27:45 +0200	[thread overview]
Message-ID: <83fsa2as1a.fsf@gnu.org> (raw)
In-Reply-To: <m1cz56oxdy.fsf@yahoo.es> (message from Daniel Martín on Sat, 18 Mar 2023 17:08:25 +0100)

> From: Daniel Martín <mardani29@yahoo.es>
> Cc: casouri@gmail.com,  62238@debbugs.gnu.org,  philipk@posteo.net,
>   theo@thornhill.no
> Date: Sat, 18 Mar 2023 17:08:25 +0100
> 
> Eli Zaretskii <eliz@gnu.org> writes:
> 
> > 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?
> 
> Note that basing C-M-x on syntax tables (that is, traditional
> forward-sexp) does not completely exclude the use of Tree-sitter, AFAIU.
> Here's my thought process: To do its job, C-M-x needs to know about some
> code structures such as symbol constituents, strings, comments, and
> parenthetical groups.  If in some language or future version of C the
> syntax is complex enough that getting the syntax class of a character
> requires proper parsing, the Tree-sitter major modes can augment the
> syntax table to make C-M-x work correctly.  See
> c-ts-mode--syntax-propertize for an example of how Tree-sitter can
> augment a buffer's syntax table, if needed.

We have already C mode that uses syntax tables.  I think it's useful
to try syntactic movement using results of parsing as well, and
compare the relative merits and demerits.

> > 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.
> 
> I agree that using a single function for every language is great for
> simplicity and maintainability but, should it handle every movement
> command as well?  My main concern is that a single function
> (treesit--navigate-thing) is now being used not only for every language,
> but for every structural movement command.  I think that it is difficult
> that a single piece of logic can handle all structure movement commands
> well.  There's a good chance that the code will end up being complex and
> difficult to maintain.

Instead of deciding up front that it could be a problem, I suggest to
try the tree-sitter based way and see how well it works.  We can
always go back to syntax tables if we decide they will work better for
some modes.  It makes little sense to me to make such decisions
without trying the tree-sitter way and trying it well.





  parent reply	other threads:[~2023-03-18 17:27 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
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 [this message]
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

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=83fsa2as1a.fsf@gnu.org \
    --to=eliz@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 external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.