From unknown Sun Jun 15 08:58:31 2025 X-Loop: help-debbugs@gnu.org Subject: bug#62302: 30.0.50; c/c++ tree sitter forward-sexp problem Resent-From: "Herman, Geza" Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 20 Mar 2023 20:41:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 62302 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: 62302@debbugs.gnu.org X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.167934483819247 (code B ref -1); Mon, 20 Mar 2023 20:41:02 +0000 Received: (at submit) by debbugs.gnu.org; 20 Mar 2023 20:40:38 +0000 Received: from localhost ([127.0.0.1]:56893 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1peMJ4-00050N-0n for submit@debbugs.gnu.org; Mon, 20 Mar 2023 16:40:38 -0400 Received: from lists.gnu.org ([209.51.188.17]:41796) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1peMJ1-00050F-Hc for submit@debbugs.gnu.org; Mon, 20 Mar 2023 16:40:36 -0400 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 1peMJ0-0005ok-Pu for bug-gnu-emacs@gnu.org; Mon, 20 Mar 2023 16:40:34 -0400 Received: from mail-wm1-x335.google.com ([2a00:1450:4864:20::335]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1peMIw-0000PY-Ua for bug-gnu-emacs@gnu.org; Mon, 20 Mar 2023 16:40:33 -0400 Received: by mail-wm1-x335.google.com with SMTP id iw17so3027578wmb.0 for ; Mon, 20 Mar 2023 13:40:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1679344828; h=content-transfer-encoding:subject:from:to:content-language :user-agent:mime-version:date:message-id:from:to:cc:subject:date :message-id:reply-to; bh=C/+u47pVJdwsebMmVW+SVuxAGSy4EAg+TCEsdP8BEOQ=; b=RgxiITzagfG5Gbf/LipY2PHNCVd5aM+Qpbdk9aE1zrrCx/l+NNLG+s+S6qqKmA7rhW Ee1BdLgufbC69gI8F3HLFN9wYQOHbE/8UfcCu19ZmvuBjHpw8Uy+63mxSVUtYX5075us JfIs56CpT0AMjqSvGJ7n66Do1Ij2DwSZdeRKScjhZvUfGm4cASZ3r0hN8R5dt40aQYvF D0QRdvK0t7oqQc0cwhPb680EPwB7YEGC60bDxF+O0jV+nLpqqV1V+uX62YizoYycjcY7 N0qQGQMqLQ7ipaH+4vQyHF4hy/+ArEYRrSkSqtkqdDghbM7SYLNxEJeAglmBvyKQ2xPl YSqQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1679344828; h=content-transfer-encoding:subject:from:to:content-language :user-agent:mime-version:date:message-id:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=C/+u47pVJdwsebMmVW+SVuxAGSy4EAg+TCEsdP8BEOQ=; b=cHlr84TgrPLXM7VV5/aGmkw06tqwHh6KWGnPIriU2oihKscvmKThQSt1Yvk2YuR6Ch LKnsoXiihDF+2qRHGDAawvTag6U+qCNh9OMaHwGP7JJ9dinQYcLdMbhFylqhZd+lebat gccNKlnFc4lHy5gEsbpWoWHV+D0NSj55osfipimTWPZ4Hbon+d+wRUCpw1h530F9EyLW RvG7oMvuxEZLQAhyt0So/om8VAsTuDe+D0aN1qdt3qnbKNhPxnCxtz/58x2ceATB0Z1X Sy+RCmQ3d56qrnPLCRhRO7mugGOpiqnx1JDBRbHzhO6cuxumJ6Ag3KJaqUCadrJ++hGp JmNg== X-Gm-Message-State: AO0yUKUK3pXq0G9+6+4GN466oSjgDZi2ueIuVjWD6xlG8XKAYGGxFqbL lNxMM+5alnblLtsvpseP82fQP2Qp/Pg= X-Google-Smtp-Source: AK7set9dU5unD9niMloEa8WZQHucuHq9ANwWwmkw20AofafPwLGhYolhtg30x7MGEXkvqiyFaLrdTg== X-Received: by 2002:a05:600c:2258:b0:3ed:290b:dc76 with SMTP id a24-20020a05600c225800b003ed290bdc76mr606963wmm.1.1679344828112; Mon, 20 Mar 2023 13:40:28 -0700 (PDT) Received: from [10.9.10.122] (62-77-231-86.static.invitel.hu. [62.77.231.86]) by smtp.gmail.com with ESMTPSA id h20-20020a1ccc14000000b003dc522dd25esm11435658wmb.30.2023.03.20.13.40.27 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 20 Mar 2023 13:40:27 -0700 (PDT) Message-ID: Date: Mon, 20 Mar 2023 21:40:26 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.6.0 Content-Language: en-US From: "Herman, Geza" Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Received-SPF: pass client-ip=2a00:1450:4864:20::335; envelope-from=geza.herman@gmail.com; helo=mail-wm1-x335.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: -1.3 (-) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.3 (--) 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 This will move the point to the space character in "int a;". But without tree sitter, this moves the point to the closing brace of main (I believe this is the correct behavior). 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 Hideshow should hide the whole body of main, but instead it only hides parts of the body, and the buffer ends up like this: int main() {... a;     }    int b; } If I set forward-sexp-function to nil, the problem goes away. I think this issue is somewhat related to #60894 Here's the little example program: int main() {     if (false) {         int a;     }     int b; } In GNU Emacs 30.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version  3.24.36, cairo version 1.16.0) of 2023-03-20 built on okoska Repository revision: 42fba8f36b19536964d6deb6a34f3fd1c02b43dd Repository branch: master Windowing system distributor 'The X.Org Foundation', version 11.0.12101006 System Description: Debian GNU/Linux bookworm/sid Configured using:  'configure --with-native-compilation=aot --without-compress-install  --with-json --with-xinput2 --with-xwidgets --with-tree-sitter  --with-cairo' Configured features: ACL CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GPM GSETTINGS HARFBUZZ JPEG JSON LCMS2 LIBOTF LIBSELINUX LIBSYSTEMD LIBXML2 M17N_FLT MODULES NATIVE_COMP NOTIFY INOTIFY PDUMPER PNG SECCOMP SOUND SQLITE3 THREADS TIFF TOOLKIT_SCROLL_BARS TREE_SITTER WEBP X11 XDBE XIM XINPUT2 XPM XWIDGETS GTK3 ZLIB Important settings:   value of $LC_ALL: C.UTF-8   value of $LANG: en_US.UTF-8   value of $XMODIFIERS: @im=none   locale-coding-system: utf-8-unix Major mode: C++// Minor modes in effect:   tooltip-mode: t   global-eldoc-mode: t   show-paren-mode: t   electric-indent-mode: t   mouse-wheel-mode: t   tool-bar-mode: t   menu-bar-mode: t   file-name-shadow-mode: t   global-font-lock-mode: t   font-lock-mode: t   blink-cursor-mode: t   line-number-mode: t   indent-tabs-mode: t   transient-mark-mode: t   auto-composition-mode: t   auto-encryption-mode: t   auto-compression-mode: t   hs-minor-mode: t Load-path shadows: None found. Features: (shadow sort mail-extr emacsbug message mailcap yank-media puny dired dired-loaddefs rfc822 mml mml-sec password-cache epa derived epg rfc6068 epg-config gnus-util text-property-search time-date mm-decode mm-bodies mm-encode mail-parse rfc2231 mailabbrev gmm-utils mailheader sendmail rfc2047 rfc2045 ietf-drums mm-util mail-prsvr mail-utils hideshow c-ts-mode c-ts-common treesit comp comp-cstr warnings icons subr-x rx cl-seq cl-macs gv cl-extra help-mode bytecomp byte-compile cc-mode cc-fonts cc-guess cc-menus cc-cmds cc-styles cc-align cc-engine cc-vars cc-defs cl-loaddefs cl-lib rmc iso-transl tooltip cconv eldoc paren electric uniquify ediff-hook vc-hooks lisp-float-type elisp-mode mwheel term/x-win x-win term/common-win x-dnd tool-bar dnd fontset image regexp-opt fringe tabulated-list replace newcomment text-mode lisp-mode prog-mode register page tab-bar menu-bar rfn-eshadow isearch easymenu timer select scroll-bar mouse jit-lock font-lock syntax font-core term/tty-colors frame minibuffer nadvice seq simple cl-generic indonesian philippine cham georgian utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao korean japanese eucjp-ms cp51932 hebrew greek romanian slovak czech european ethiopic indian cyrillic chinese composite emoji-zwj charscript charprop case-table epa-hook jka-cmpr-hook help abbrev obarray oclosure cl-preloaded button loaddefs theme-loaddefs faces cus-face macroexp files window text-properties overlay sha1 md5 base64 format env code-pages mule custom widget keymap hashtable-print-readable backquote threads xwidget-internal dbusbind inotify lcms2 dynamic-setting system-font-setting font-render-setting cairo move-toolbar gtk x-toolkit xinput2 x multi-tty make-network-process native-compile emacs) Memory information: ((conses 16 110613 15271)  (symbols 48 9248 0)  (strings 32 26736 1257)  (string-bytes 1 928972)  (vectors 16 18719)  (vector-slots 8 373020 18319)  (floats 8 32 48)  (intervals 56 274 0)  (buffers 984 13)) From unknown Sun Jun 15 08:58:31 2025 X-Loop: help-debbugs@gnu.org Subject: bug#62302: 30.0.50; c/c++ tree sitter forward-sexp problem Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 06 Apr 2023 10:12:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 62302 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: "Herman, Geza" , Yuan Fu , Theodor Thornhill Cc: 62302@debbugs.gnu.org Received: via spool by 62302-submit@debbugs.gnu.org id=B62302.168077590229585 (code B ref 62302); Thu, 06 Apr 2023 10:12:02 +0000 Received: (at 62302) by debbugs.gnu.org; 6 Apr 2023 10:11:42 +0000 Received: from localhost ([127.0.0.1]:53478 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pkMaj-0007h7-UB for submit@debbugs.gnu.org; Thu, 06 Apr 2023 06:11:42 -0400 Received: from eggs.gnu.org ([209.51.188.92]:58206) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pkMai-0007gl-4Y for 62302@debbugs.gnu.org; Thu, 06 Apr 2023 06:11:40 -0400 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 1pkMac-0001MV-9O; Thu, 06 Apr 2023 06:11:34 -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=xD75lPtOfIBXAWM5WeHmvoYz/M7sHpP+zIcNQw+3EaQ=; b=e6xiuYm3TkTEF9SSZoTe kZnAqvm2SLPagpWrwAkH0jsxFQ6M/vb2PXjAV2eXEsNW92IyVqssXZFuvSoe+dc0r8hI7n2dOpvLV A1ggsVSyl6DAvVBceGCEJDzujUbOASxNKmoqhdc7tcD1tPGvw2qHKtUZKlafqkiSqHoHagg0wTYaE 3RCOyK/rP25Czux8h7LT19txauVfgSXEAqVqyaECf/aMRRLcm1X1RFP+g96ItLlLVBa6o4n41cXLS UD2u1tXxBsOrNtUx+F26F8hxXxJXXpWB75UM/yUoFrLFJMhfOB4RP+YiZi5FQjZqwvbC4rmbLfkC9 IC5+PYatfJeJ2w==; 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 1pkMaa-0002si-Iq; Thu, 06 Apr 2023 06:11:34 -0400 Date: Thu, 06 Apr 2023 13:12:01 +0300 Message-Id: <83jzypqpzi.fsf@gnu.org> From: Eli Zaretskii In-Reply-To: (geza.herman@gmail.com) References: MIME-version: 1.0 Content-type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Spam-Score: -2.3 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > Date: Mon, 20 Mar 2023 21:40:26 +0100 > From: "Herman, Geza" > > 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 > > This will move the point to the space character in "int a;". But without > tree sitter, this moves the point to the closing brace of main (I > believe this is the correct behavior). > > 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 > > Hideshow should hide the whole body of main, but instead it only hides > parts of the body, and the buffer ends up like this: > > int main() {... a; >     } >    int b; > } > > If I set forward-sexp-function to nil, the problem goes away. I think > this issue is somewhat related to #60894 > > Here's the little example program: > > int main() { >     if (false) { >         int a; >     } >     int b; > } Theo, Yuan: any comments? Can you look into fixing this? Thanks. From unknown Sun Jun 15 08:58:31 2025 X-Loop: help-debbugs@gnu.org Subject: bug#62302: 30.0.50; c/c++ tree sitter forward-sexp problem References: 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 X-GNU-PR-Keywords: To: Eli Zaretskii Cc: theodor thornhill , 62302@debbugs.gnu.org, geza.herman@gmail.com Received: via spool by 62302-submit@debbugs.gnu.org id=B62302.16808181351926 (code B ref 62302); Thu, 06 Apr 2023 21:56:01 +0000 Received: (at 62302) by debbugs.gnu.org; 6 Apr 2023 21:55:35 +0000 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 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 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) 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) From: Yuan Fu Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3731.500.231\)) Message-Id: Date: Thu, 6 Apr 2023 14:55:11 -0700 X-Mailer: Apple Mail (2.3731.500.231) X-Spam-Score: 0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) 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 From unknown Sun Jun 15 08:58:31 2025 MIME-Version: 1.0 X-Mailer: MIME-tools 5.505 (Entity 5.505) X-Loop: help-debbugs@gnu.org From: help-debbugs@gnu.org (GNU bug Tracking System) To: "Herman, Geza" Subject: bug#62302: closed (Re: bug#62302: 30.0.50; c/c++ tree sitter forward-sexp problem) Message-ID: References: X-Gnu-PR-Message: they-closed 62302 X-Gnu-PR-Package: emacs Reply-To: 62302@debbugs.gnu.org Date: Tue, 05 Sep 2023 23:51:02 +0000 Content-Type: multipart/mixed; boundary="----------=_1693957862-20775-1" This is a multi-part message in MIME format... ------------=_1693957862-20775-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Your bug report #62302: 30.0.50; c/c++ tree sitter forward-sexp problem which was filed against the emacs package, has been closed. The explanation is attached below, along with your original report. If you require more details, please reply to 62302@debbugs.gnu.org. --=20 62302: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D62302 GNU Bug Tracking System Contact help-debbugs@gnu.org with problems ------------=_1693957862-20775-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at 62302-done) by debbugs.gnu.org; 5 Sep 2023 23:50:24 +0000 Received: from localhost ([127.0.0.1]:59869 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qdfoI-0005O1-KI for submit@debbugs.gnu.org; Tue, 05 Sep 2023 19:50:24 -0400 Received: from mail-lf1-x132.google.com ([2a00:1450:4864:20::132]:52686) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qdfoH-0005Nn-IP for 62302-done@debbugs.gnu.org; Tue, 05 Sep 2023 19:50:18 -0400 Received: by mail-lf1-x132.google.com with SMTP id 2adb3069b0e04-501bd6f7d11so2188098e87.1 for <62302-done@debbugs.gnu.org>; Tue, 05 Sep 2023 16:50:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1693957811; x=1694562611; darn=debbugs.gnu.org; h=cc:to:subject:message-id:date:mime-version:references:in-reply-to :from:from:to:cc:subject:date:message-id:reply-to; bh=hxQ2tPy0MDkeXbrzyAFRQ9a6T/6oZxQHTbKiKR4ntWc=; b=mvYccMlAIL/KlmjyyV5yBC6v2wpvuIMyioxKAkIv7gh5eSLCIOb98iZBf8CarLEj5V rjgkMrPYUQOe1F3LwLlMf7RtEVwr3c8mfbNAzGZgX9ytVqQwL8orSE1BO0XeMDGMgDzs CFQDqeFrEtD6uT1i9z0BsWSTgYBq6kzLlQ6XK/M0mIf8CWp37W0Yxh2GL0QPhtyvfMFF JVQ6k76L81tFM4sPJUYYMBb6RZP0ohc/W8F8HZp5aMRv4f0Rsnsb1Pn8jwlYNZNby2bT XEw8iAzoC4bSGkgW4jGqfMd1GIhc2OkoxENpzpxo4hxGBrG/EgMRB2ZFJeS3DQNuFVRp 6WFQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1693957811; x=1694562611; h=cc:to:subject:message-id:date:mime-version:references:in-reply-to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=hxQ2tPy0MDkeXbrzyAFRQ9a6T/6oZxQHTbKiKR4ntWc=; b=BT8rJrQU1XGch7Q1eVvWB3lDvRbfoftMHvHfvbiLeA02qbqqS84I7ViXFWAg5FmlED tFHwFEBHoBYo+W9Gf+pVQn+iQCK8b7Z722WXwlfxKwbhP3vvXlaf/w/e5GxoMoie5IBZ ju5YvrUbmTq1K/Xm9TnwVkXF/Xsa8Z529KdBtyPznn1mNHNiSMvGbusCxBJIlolMZjjh WKhCWGPA2rbi35KOzzdTR/L+onfR11/n+CrMSEios5xJef/B0qH1pHY3PaICzZrF93BI o9ig00D+4SlpQYCT4//3lZdR4kmyvMOuavhKbSr6w6pU82u3Wjw0RcmYqf9GoJHPDxEz 7ARg== X-Gm-Message-State: AOJu0YxxP+f9els/46zJv/e/KK8UVVfwDQVij00s+H7L+9E8p2aBBSie YDW6mIhokYth53rlKyMjOQyULVye3oxfEBe5ntc= X-Google-Smtp-Source: AGHT+IG0eM0UyVWoimlOpMGYbMp4PpwUcjmqVJveEUWCkf11dmZi99HT4d03ILItuuFxIIW1dBlN4EfgfHpCT/chQk4= X-Received: by 2002:a05:6512:2393:b0:500:b5db:990b with SMTP id c19-20020a056512239300b00500b5db990bmr1030209lfv.47.1693957810608; Tue, 05 Sep 2023 16:50:10 -0700 (PDT) Received: from 753933720722 named unknown by gmailapi.google.com with HTTPREST; Tue, 5 Sep 2023 16:50:10 -0700 From: Stefan Kangas In-Reply-To: (Yuan Fu's message of "Thu, 6 Apr 2023 14:55:11 -0700") References: MIME-Version: 1.0 Date: Tue, 5 Sep 2023 16:50:10 -0700 Message-ID: Subject: Re: bug#62302: 30.0.50; c/c++ tree sitter forward-sexp problem To: Yuan Fu Content-Type: text/plain; charset="UTF-8" X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 62302-done Cc: Eli Zaretskii , theodor thornhill , geza.herman@gmail.com, 62302-done@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Yuan Fu writes: > Eli Zaretskii writes: > >>> Date: Mon, 20 Mar 2023 21:40:26 +0100 >>> From: "Herman, Geza" >>> >>> 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 >>> >>> This will move the point to the space character in "int a;". But without >>> tree sitter, this moves the point to the closing brace of main (I >>> believe this is the correct behavior). >>> >>> 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 >>> >>> Hideshow should hide the whole body of main, but instead it only hides >>> parts of the body, and the buffer ends up like this: >>> >>> int main() {... a; >>> } >>> int b; >>> } >>> >>> If I set forward-sexp-function to nil, the problem goes away. I think >>> this issue is somewhat related to #60894 >>> >>> Here's the little example program: >>> >>> 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 It seems like this has been fixed, so I'm closing this bug report. ------------=_1693957862-20775-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at submit) by debbugs.gnu.org; 20 Mar 2023 20:40:38 +0000 Received: from localhost ([127.0.0.1]:56893 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1peMJ4-00050N-0n for submit@debbugs.gnu.org; Mon, 20 Mar 2023 16:40:38 -0400 Received: from lists.gnu.org ([209.51.188.17]:41796) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1peMJ1-00050F-Hc for submit@debbugs.gnu.org; Mon, 20 Mar 2023 16:40:36 -0400 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 1peMJ0-0005ok-Pu for bug-gnu-emacs@gnu.org; Mon, 20 Mar 2023 16:40:34 -0400 Received: from mail-wm1-x335.google.com ([2a00:1450:4864:20::335]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1peMIw-0000PY-Ua for bug-gnu-emacs@gnu.org; Mon, 20 Mar 2023 16:40:33 -0400 Received: by mail-wm1-x335.google.com with SMTP id iw17so3027578wmb.0 for ; Mon, 20 Mar 2023 13:40:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1679344828; h=content-transfer-encoding:subject:from:to:content-language :user-agent:mime-version:date:message-id:from:to:cc:subject:date :message-id:reply-to; bh=C/+u47pVJdwsebMmVW+SVuxAGSy4EAg+TCEsdP8BEOQ=; b=RgxiITzagfG5Gbf/LipY2PHNCVd5aM+Qpbdk9aE1zrrCx/l+NNLG+s+S6qqKmA7rhW Ee1BdLgufbC69gI8F3HLFN9wYQOHbE/8UfcCu19ZmvuBjHpw8Uy+63mxSVUtYX5075us JfIs56CpT0AMjqSvGJ7n66Do1Ij2DwSZdeRKScjhZvUfGm4cASZ3r0hN8R5dt40aQYvF D0QRdvK0t7oqQc0cwhPb680EPwB7YEGC60bDxF+O0jV+nLpqqV1V+uX62YizoYycjcY7 N0qQGQMqLQ7ipaH+4vQyHF4hy/+ArEYRrSkSqtkqdDghbM7SYLNxEJeAglmBvyKQ2xPl YSqQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1679344828; h=content-transfer-encoding:subject:from:to:content-language :user-agent:mime-version:date:message-id:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=C/+u47pVJdwsebMmVW+SVuxAGSy4EAg+TCEsdP8BEOQ=; b=cHlr84TgrPLXM7VV5/aGmkw06tqwHh6KWGnPIriU2oihKscvmKThQSt1Yvk2YuR6Ch LKnsoXiihDF+2qRHGDAawvTag6U+qCNh9OMaHwGP7JJ9dinQYcLdMbhFylqhZd+lebat gccNKlnFc4lHy5gEsbpWoWHV+D0NSj55osfipimTWPZ4Hbon+d+wRUCpw1h530F9EyLW RvG7oMvuxEZLQAhyt0So/om8VAsTuDe+D0aN1qdt3qnbKNhPxnCxtz/58x2ceATB0Z1X Sy+RCmQ3d56qrnPLCRhRO7mugGOpiqnx1JDBRbHzhO6cuxumJ6Ag3KJaqUCadrJ++hGp JmNg== X-Gm-Message-State: AO0yUKUK3pXq0G9+6+4GN466oSjgDZi2ueIuVjWD6xlG8XKAYGGxFqbL lNxMM+5alnblLtsvpseP82fQP2Qp/Pg= X-Google-Smtp-Source: AK7set9dU5unD9niMloEa8WZQHucuHq9ANwWwmkw20AofafPwLGhYolhtg30x7MGEXkvqiyFaLrdTg== X-Received: by 2002:a05:600c:2258:b0:3ed:290b:dc76 with SMTP id a24-20020a05600c225800b003ed290bdc76mr606963wmm.1.1679344828112; Mon, 20 Mar 2023 13:40:28 -0700 (PDT) Received: from [10.9.10.122] (62-77-231-86.static.invitel.hu. [62.77.231.86]) by smtp.gmail.com with ESMTPSA id h20-20020a1ccc14000000b003dc522dd25esm11435658wmb.30.2023.03.20.13.40.27 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 20 Mar 2023 13:40:27 -0700 (PDT) Message-ID: Date: Mon, 20 Mar 2023 21:40:26 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.6.0 Content-Language: en-US To: bug-gnu-emacs@gnu.org From: "Herman, Geza" Subject: 30.0.50; c/c++ tree sitter forward-sexp problem Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Received-SPF: pass client-ip=2a00:1450:4864:20::335; envelope-from=geza.herman@gmail.com; helo=mail-wm1-x335.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: -1.3 (-) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.3 (--) 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 This will move the point to the space character in "int a;". But without tree sitter, this moves the point to the closing brace of main (I believe this is the correct behavior). 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 Hideshow should hide the whole body of main, but instead it only hides parts of the body, and the buffer ends up like this: int main() {... a;     }    int b; } If I set forward-sexp-function to nil, the problem goes away. I think this issue is somewhat related to #60894 Here's the little example program: int main() {     if (false) {         int a;     }     int b; } In GNU Emacs 30.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version  3.24.36, cairo version 1.16.0) of 2023-03-20 built on okoska Repository revision: 42fba8f36b19536964d6deb6a34f3fd1c02b43dd Repository branch: master Windowing system distributor 'The X.Org Foundation', version 11.0.12101006 System Description: Debian GNU/Linux bookworm/sid Configured using:  'configure --with-native-compilation=aot --without-compress-install  --with-json --with-xinput2 --with-xwidgets --with-tree-sitter  --with-cairo' Configured features: ACL CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GPM GSETTINGS HARFBUZZ JPEG JSON LCMS2 LIBOTF LIBSELINUX LIBSYSTEMD LIBXML2 M17N_FLT MODULES NATIVE_COMP NOTIFY INOTIFY PDUMPER PNG SECCOMP SOUND SQLITE3 THREADS TIFF TOOLKIT_SCROLL_BARS TREE_SITTER WEBP X11 XDBE XIM XINPUT2 XPM XWIDGETS GTK3 ZLIB Important settings:   value of $LC_ALL: C.UTF-8   value of $LANG: en_US.UTF-8   value of $XMODIFIERS: @im=none   locale-coding-system: utf-8-unix Major mode: C++// Minor modes in effect:   tooltip-mode: t   global-eldoc-mode: t   show-paren-mode: t   electric-indent-mode: t   mouse-wheel-mode: t   tool-bar-mode: t   menu-bar-mode: t   file-name-shadow-mode: t   global-font-lock-mode: t   font-lock-mode: t   blink-cursor-mode: t   line-number-mode: t   indent-tabs-mode: t   transient-mark-mode: t   auto-composition-mode: t   auto-encryption-mode: t   auto-compression-mode: t   hs-minor-mode: t Load-path shadows: None found. Features: (shadow sort mail-extr emacsbug message mailcap yank-media puny dired dired-loaddefs rfc822 mml mml-sec password-cache epa derived epg rfc6068 epg-config gnus-util text-property-search time-date mm-decode mm-bodies mm-encode mail-parse rfc2231 mailabbrev gmm-utils mailheader sendmail rfc2047 rfc2045 ietf-drums mm-util mail-prsvr mail-utils hideshow c-ts-mode c-ts-common treesit comp comp-cstr warnings icons subr-x rx cl-seq cl-macs gv cl-extra help-mode bytecomp byte-compile cc-mode cc-fonts cc-guess cc-menus cc-cmds cc-styles cc-align cc-engine cc-vars cc-defs cl-loaddefs cl-lib rmc iso-transl tooltip cconv eldoc paren electric uniquify ediff-hook vc-hooks lisp-float-type elisp-mode mwheel term/x-win x-win term/common-win x-dnd tool-bar dnd fontset image regexp-opt fringe tabulated-list replace newcomment text-mode lisp-mode prog-mode register page tab-bar menu-bar rfn-eshadow isearch easymenu timer select scroll-bar mouse jit-lock font-lock syntax font-core term/tty-colors frame minibuffer nadvice seq simple cl-generic indonesian philippine cham georgian utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao korean japanese eucjp-ms cp51932 hebrew greek romanian slovak czech european ethiopic indian cyrillic chinese composite emoji-zwj charscript charprop case-table epa-hook jka-cmpr-hook help abbrev obarray oclosure cl-preloaded button loaddefs theme-loaddefs faces cus-face macroexp files window text-properties overlay sha1 md5 base64 format env code-pages mule custom widget keymap hashtable-print-readable backquote threads xwidget-internal dbusbind inotify lcms2 dynamic-setting system-font-setting font-render-setting cairo move-toolbar gtk x-toolkit xinput2 x multi-tty make-network-process native-compile emacs) Memory information: ((conses 16 110613 15271)  (symbols 48 9248 0)  (strings 32 26736 1257)  (string-bytes 1 928972)  (vectors 16 18719)  (vector-slots 8 373020 18319)  (floats 8 32 48)  (intervals 56 274 0)  (buffers 984 13)) ------------=_1693957862-20775-1--