From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Theodor Thornhill via "Bug reports for GNU Emacs, the Swiss army knife of text editors" Newsgroups: gmane.emacs.bugs Subject: bug#62238: 30.0.50; Unusual interpretation of "S-expressions" in c-ts-mode Date: Sat, 18 Mar 2023 14:32:51 +0100 Message-ID: References: <87ilezg0wo.fsf@posteo.net> <7FDC4392-AC34-4EA2-A166-AB10755361CD@gmail.com> Reply-To: Theodor Thornhill Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="6720"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 62238@debbugs.gnu.org, Philip Kaludercic To: Daniel =?UTF-8?Q?Mart=C3=ADn?= , Yuan Fu Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Mar 18 14:33:11 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 1pdWgI-0001VT-EU for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 18 Mar 2023 14:33:10 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pdWgD-0006P7-4b; Sat, 18 Mar 2023 09:33:05 -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 1pdWgA-0006Oj-FR for bug-gnu-emacs@gnu.org; Sat, 18 Mar 2023 09:33:02 -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 1pdWgA-0003AR-7p for bug-gnu-emacs@gnu.org; Sat, 18 Mar 2023 09:33:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1pdWgA-0003Vp-3Y for bug-gnu-emacs@gnu.org; Sat, 18 Mar 2023 09:33:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Theodor Thornhill Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 18 Mar 2023 13:33: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.167914637913493 (code B ref 62238); Sat, 18 Mar 2023 13:33:02 +0000 Original-Received: (at 62238) by debbugs.gnu.org; 18 Mar 2023 13:32:59 +0000 Original-Received: from localhost ([127.0.0.1]:46663 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pdWg6-0003VY-ST for submit@debbugs.gnu.org; Sat, 18 Mar 2023 09:32:59 -0400 Original-Received: from out-42.mta1.migadu.com ([95.215.58.42]:10754) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pdWg4-0003VP-9a for 62238@debbugs.gnu.org; Sat, 18 Mar 2023 09:32:57 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=thornhill.no; s=key1; t=1679146373; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=3HHHfCKs/jKwKzdYBVIcrIVGCShh8+1cJZiNbAZX2TE=; b=b1yWPk3J3x4pKLlOTLtLh+r2fIBib+hmispmIKzlowjTDe6etOO1jP0G3VwanMX5ElZ00/ mZuwUStW/AGlFwnAyFKN3fQhIlJF4MJijrk3WssZnsUhc9bmocP2dhTKj7S0nQ5QsCpLUu I5y8o4uvOLwDJvMsfH96tscSF73qGtO7qO/Klf+ZXrijc2cvUz/dDgt57MSwx9ggg/73ZG GGgesQk6P0Jrq4RXGPOEkHNuGby20KexJC/JFgv4pShbKNBAQmJMFfEiHeRnCPJil8okIX nsA/ovQ4mZJvlyDJAIwiaXn5CfGdcIk1Mo/8lWIoAFF7c0uEWgb5dTChgdeAAw== X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. In-Reply-To: X-Migadu-Flow: FLOW_OUT 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:258174 Archived-At: On 18 March 2023 13:11:15 CET, "Daniel Mart=C3=ADn" = wrote: >Daniel Mart=C3=ADn writes: > >> Yuan Fu writes: >> >>> >>> I tested this on my Emacs session and vanilla session, and both marked >>> to the closing bracket=2E I believe forward-sexp should just work by t= he >>> syntax table=2E Perhaps it=E2=80=99s your config or something? >>> >> >> You need to enable c-ts-mode first, which redirects >> forward-sexp-function to treesit-forward-sexp=2E > >I see in treesit=2Eel that we set forward-sexp-function to >treesit-forward-sexp when treesit-sexp-type-regexp is set by the major >mode=2E 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=2E I'd suggest we don't define treesit-sexp-type-regexp i= n >c-ts-mode, at least for C=2E > >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=2E > >Thanks=2E I tend to agree=2E I think it works pretty well with java for instance, bu= t I'm struggling with the compound_statement node in the c grammar=2E If too much of an annoyance, I'm ok with not defining this for c, but mayb= e someone that writes more c than me can have a go at defining nodes that m= akes sense? Theo