From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Yuan Fu Newsgroups: gmane.emacs.bugs Subject: bug#62302: 30.0.50; c/c++ tree sitter forward-sexp problem Date: Thu, 6 Apr 2023 14:55:11 -0700 Message-ID: References: Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3731.500.231\)) Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="9351"; mail-complaints-to="usenet@ciao.gmane.io" Cc: theodor thornhill , 62302@debbugs.gnu.org, geza.herman@gmail.com To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu Apr 06 23:56:26 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 1pkXaj-0002Gd-Ss for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 06 Apr 2023 23:56:25 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pkXaO-0001he-Ss; Thu, 06 Apr 2023 17:56:04 -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 1pkXaM-0001hL-Nj for bug-gnu-emacs@gnu.org; Thu, 06 Apr 2023 17:56: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 1pkXaM-00033l-F3 for bug-gnu-emacs@gnu.org; Thu, 06 Apr 2023 17:56:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1pkXaL-0000Vh-St for bug-gnu-emacs@gnu.org; Thu, 06 Apr 2023 17:56:01 -0400 X-Loop: help-debbugs@gnu.org In-Reply-To: Resent-From: Yuan Fu Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 06 Apr 2023 21:56:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 62302 X-GNU-PR-Package: emacs Original-Received: via spool by 62302-submit@debbugs.gnu.org id=B62302.16808181351926 (code B ref 62302); Thu, 06 Apr 2023 21:56:01 +0000 Original-Received: (at 62302) by debbugs.gnu.org; 6 Apr 2023 21:55:35 +0000 Original-Received: from localhost ([127.0.0.1]:55347 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pkXZu-0000Uz-Qi for submit@debbugs.gnu.org; Thu, 06 Apr 2023 17:55:35 -0400 Original-Received: from mail-pl1-f169.google.com ([209.85.214.169]:36544) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pkXZp-0000UX-FX for 62302@debbugs.gnu.org; Thu, 06 Apr 2023 17:55:33 -0400 Original-Received: by mail-pl1-f169.google.com with SMTP id ix20so38703422plb.3 for <62302@debbugs.gnu.org>; Thu, 06 Apr 2023 14:55:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1680818123; h=to:cc:date:message-id:subject:mime-version :content-transfer-encoding:from:from:to:cc:subject:date:message-id :reply-to; bh=JSMppyMGOLHAQlVhsGnjzlFFCjJHfBbXlF1DUlHytTE=; b=XmOdt/M17ZrhAQUzFfq9FWzczo6SE5+djTiwibyPZIcfzPSjw5kvwa04RZMHmuLWcB tWoIfYHXvb3JrJxOrbSBvgqdY/THbCUJR2wRAOL9YWr6m14d+0b7zE7bJAa08Ru8mLUV KGmkkBoNyBPj7Uaqh/ZqmTPd0CWJglad4yiHnwj2yOBeaXTN5SstC1M0/J9zq1rsrngE NGdw1QLGQ8fUnEVBFeGzBbARhzLkdysrnNZqb/wHEEnUcusHcI3uP1yDv6UUtBwRo3hp fvrKQPhHel+awOy/SjposaDvFhdV5/YWkSdgJaEMgzF02y1OsS8iBygnd4AU3tPplNpg uUyQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1680818123; h=to:cc:date:message-id:subject:mime-version :content-transfer-encoding:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=JSMppyMGOLHAQlVhsGnjzlFFCjJHfBbXlF1DUlHytTE=; b=nBl6ipuRnWdgMIm/EOEkkTQuZ5REgYUYNhnL4/DlNTdpUWo2yspz85ON0IXh6Ra/gF nlVHNGCMqN38YjtrDXpJh/07U1gP/IIkDDETvJTNzWYcu1eo+swVf/1jEUKdoNIf7AxJ xA+1zKymbNViV1kpDGCupMpQOebVIPgunXjs+1seVtGOMfc6FOdLGMeZD+TF4wxzhSW/ KZ+S4a3+bofvvffD5UBJ+clc1SZMs9sLKBcEXUeQYRvvXjN7+enDd5qFn0akyfnQFaVR fdPVhve4VFXzsjrF3TK21krHlQPRqu5kVD06HJ4MMdkczwawH0UoXX8N6Rk4abm3hl94 VAdQ== X-Gm-Message-State: AAQBX9drISYdt3o4/UOTW3umNip1SjLr0kcq/55a7X7cAZ5/LNB6TzRc dXsQhl+6tIGxRPdBkNwbEzs= X-Google-Smtp-Source: AKy350aEV3C01ey5TJbGD9gA39MJNRfwSWea6B/cIaHDFHdCOlBdHCZuVIQplNW5RrIBiKjGHXWZVQ== X-Received: by 2002:a17:902:e5c8:b0:1a1:ee8c:eed7 with SMTP id u8-20020a170902e5c800b001a1ee8ceed7mr594618plf.67.1680818123365; Thu, 06 Apr 2023 14:55:23 -0700 (PDT) Original-Received: from smtpclient.apple (cpe-172-117-161-177.socal.res.rr.com. [172.117.161.177]) by smtp.gmail.com with ESMTPSA id h3-20020a654683000000b00502fd141ffbsm1567135pgr.49.2023.04.06.14.55.22 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 06 Apr 2023 14:55:23 -0700 (PDT) X-Mailer: Apple Mail (2.3731.500.231) 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:259359 Archived-At: Eli Zaretskii writes: >> Date: Mon, 20 Mar 2023 21:40:26 +0100 >> From: "Herman, Geza" >>=20 >> With tree sitter, forward-sexp behaves a little strange. To = reproduce: >> - copy the little example program below into a c++-ts-mode buffer >> - move the point to the opening curly brace of "main() {" >> - M-x forward-sexp >>=20 >> This will move the point to the space character in "int a;". But = without=20 >> tree sitter, this moves the point to the closing brace of main (I=20 >> believe this is the correct behavior). >>=20 >> I noticed this problem because hideshow behaves strangely with tree = sitter: >> - enable hideshow mode (M-x hs-minor-mode) >> - move the point to the same opening brace >> - M-x hs-toggle-hiding >>=20 >> Hideshow should hide the whole body of main, but instead it only = hides=20 >> parts of the body, and the buffer ends up like this: >>=20 >> int main() {... a; >> } >> int b; >> } >>=20 >> If I set forward-sexp-function to nil, the problem goes away. I think=20= >> this issue is somewhat related to #60894 >>=20 >> Here's the little example program: >>=20 >> int main() { >> if (false) { >> int a; >> } >> int b; >> } > > Theo, Yuan: any comments? Can you look into fixing this? > > Thanks. Missed this, sorry :-) I modified the definition of "sexp" in c/c++-ts-mode. I think new definition is intuitive but only time will tell. The new definition works on the little example in this report. Yuan