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#61374: 30.0.50; Wrong mark-sexp with tree-sitter Date: Thu, 09 Feb 2023 09:42:43 +0100 Message-ID: <871qmzb56k.fsf@thornhill.no> References: <875ycbitav.fsf.ref@aol.com> <875ycbitav.fsf@aol.com> <835ycbnxyc.fsf@gnu.org> Reply-To: Theodor Thornhill Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="8753"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 61374@debbugs.gnu.org To: Eli Zaretskii , Ergus , Yuan Fu Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu Feb 09 09:43:19 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 1pQ2WV-0002Bi-Ef for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 09 Feb 2023 09:43:19 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pQ2WH-0004b3-54; Thu, 09 Feb 2023 03:43:05 -0500 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 1pQ2WF-0004ar-2i for bug-gnu-emacs@gnu.org; Thu, 09 Feb 2023 03:43:03 -0500 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 1pQ2WE-0006bb-QV for bug-gnu-emacs@gnu.org; Thu, 09 Feb 2023 03:43:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1pQ2WE-0000AM-GV for bug-gnu-emacs@gnu.org; Thu, 09 Feb 2023 03:43:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Theodor Thornhill Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 09 Feb 2023 08:43:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 61374 X-GNU-PR-Package: emacs Original-Received: via spool by 61374-submit@debbugs.gnu.org id=B61374.1675932169615 (code B ref 61374); Thu, 09 Feb 2023 08:43:02 +0000 Original-Received: (at 61374) by debbugs.gnu.org; 9 Feb 2023 08:42:49 +0000 Original-Received: from localhost ([127.0.0.1]:57409 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pQ2W1-00009r-1x for submit@debbugs.gnu.org; Thu, 09 Feb 2023 03:42:49 -0500 Original-Received: from out-77.mta1.migadu.com ([95.215.58.77]:64698) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pQ2Vx-00009h-Vz for 61374@debbugs.gnu.org; Thu, 09 Feb 2023 03:42:47 -0500 X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=thornhill.no; s=key1; t=1675932164; 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: in-reply-to:in-reply-to:references:references; bh=Bgn3tT8GFctVFEe7va50/xQRhaCixA1V64c1tdpLW38=; b=wo2pbTOSqiuoDkhljbYicKBSb8bIf3+X6KqvWhxuBmTWDV4WcdLePEiNwAssHuYAT4xboK 4p52JgTbmleyR/TZVOJ5UqsasqtZt5ykX5RnANtZhVfUAHFs9P+1+ViRXtK55PES9oGqsa A0lf9w09y+w3vsxdjM6RbBdkt5uervlvLT0eKZ3Ep8Ud8ABqGRN7wo0ZUGqGMfpIAW9oSm 8m0qRNdUjvJV/cdo05TG8pgfOF+VXmu1HIZ9In7AYarvTcxO/ZXKqOdPjMEgVHYHU0DIu1 5CWyYU8bzhBEXITmZWOwZSGNTPKw9fJeZW/AKgFVzo4duy+sKFUDPptUNEjeEA== 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:255195 Archived-At: Theodor Thornhill writes: > On 9 February 2023 07:40:27 CET, Eli Zaretskii wrote: >>> Date: Thu, 09 Feb 2023 01:19:52 +0100 >>> From: Ergus via "Bug reports for GNU Emacs, >>> the Swiss army knife of text editors" >>> >>> Just trying tree-sitter with c++-mode is doing a wrong mark-sexp. >>> >>> With this code: >>> >>> { >>> vector myvar; >>> } >>> >>> M-x c++-ts-mode >>> >>> go to { and do C-M-SPC. The region marked goes from { up to > instead of >>> the corresponding } >> >>The problem is in forward-sexp (try C-M-f from the same place), which >>C-M-SPC calls. This problem exists only on master, where forward-sexp >>was modified to call treesit-forward-sexp; on emacs-29 the behavior is >>as expected. >> >>CC'ing Yuan and Theo, who will probably find a fix in no time... >> >>Thanks. > > I'll look at it in just a bit :) > > Thanks for pinging! > > Theo I think to remember why I decided on the current settings in 'treesit-sexp-type-regexp' - compound_statement is very frequently used in the c/c++ grammars, and iirc that makes sexp-moving almost always move to end of the next or current compound_statement. try adding ``` (setq-local treesit-sexp-type-regexp (regexp-opt '("preproc" "declarator" "qualifier" "type" "parameter" "expression" "literal" "string" "statement"))) ``` and observe that mark-sexp and forward-sexp is ok now wrt this bug-report, but running same commands inside of a scope may not. I'm not sure what the best combination of nodes for this particular regexp is, but maybe you can give me some expectations, Ergus, and I can follow up with some new settings? Theo