From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#62238: 30.0.50; Unusual interpretation of "S-expressions" in c-ts-mode Date: Sat, 18 Mar 2023 15:33:49 +0200 Message-ID: <83jzzeb2v6.fsf@gnu.org> References: <87ilezg0wo.fsf@posteo.net> <7FDC4392-AC34-4EA2-A166-AB10755361CD@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="12245"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 62238@debbugs.gnu.org, casouri@gmail.com, theo@thornhill.no, philipk@posteo.net To: Daniel =?UTF-8?Q?Mart=C3=ADn?= Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Mar 18 14:34:13 2023 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pdWhI-0002xg-5S for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 18 Mar 2023 14:34:12 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pdWhB-0006hf-Vo; Sat, 18 Mar 2023 09:34:06 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pdWhA-0006hU-OD for bug-gnu-emacs@gnu.org; Sat, 18 Mar 2023 09:34:04 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pdWh8-0003JC-6x for bug-gnu-emacs@gnu.org; Sat, 18 Mar 2023 09:34:04 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1pdWh8-0003XK-2P for bug-gnu-emacs@gnu.org; Sat, 18 Mar 2023 09:34:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 18 Mar 2023 13:34:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 62238 X-GNU-PR-Package: emacs Original-Received: via spool by 62238-submit@debbugs.gnu.org id=B62238.167914643513582 (code B ref 62238); Sat, 18 Mar 2023 13:34:02 +0000 Original-Received: (at 62238) by debbugs.gnu.org; 18 Mar 2023 13:33:55 +0000 Original-Received: from localhost ([127.0.0.1]:46668 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pdWh1-0003X0-F3 for submit@debbugs.gnu.org; Sat, 18 Mar 2023 09:33:55 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:57996) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pdWgz-0003Wl-Ew for 62238@debbugs.gnu.org; Sat, 18 Mar 2023 09:33:54 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pdWgt-0003HQ-LZ; Sat, 18 Mar 2023 09:33:47 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-version:References:Subject:In-Reply-To:To:From: Date; bh=OXHikaQT9l4H4z064cGoTEYoZgEDzXZd79/ZKaGxdmI=; b=H2Jdt5EijqTnCW1pf9Ld xdMOifkUBiap1wY13oRAflwwkpd/Fa8v7fPtplqbethZgLsO5/ly/76Pl4HYc/4cTubtbmnelkugU K8bdACyriNiRsAtnvQztls9mB1PYfniT/SvTgxhk6o9pk9InQWxLOBq4BWoJAQllc2clcrZyCA065 YrcUrqw3LEA/INrrj8btDnujmrD5xc6OD1OhTPWa5Fmj62JjbrhsHupTeNJ6SP7U0ZXhLVl6DynTL EB5+LgqHK5e/RL/RN3xDIBKjju72VkKUJpi4h2R2j+mkN1h58T/f7KrueP0oown1gwJ6gn6PNZqa0 a8U9938QW1vj9w==; Original-Received: from [87.69.77.57] (helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pdWgr-0002vX-Ft; Sat, 18 Mar 2023 09:33:46 -0400 In-Reply-To: (bug-gnu-emacs@gnu.org) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:258175 Archived-At: > Cc: 62238@debbugs.gnu.org, Philip Kaludercic , > theodor thornhill > 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" > > > 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.