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#68652: 29.1.50; treesit defun commands broken near beginning of function Date: Sat, 27 Jan 2024 19:55:52 -0800 Message-ID: References: <86h6iz83fg.fsf@gnu.org> Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3731.700.6\)) 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="34876"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 68652@debbugs.gnu.org, Troy Brown To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Jan 28 04:57:20 2024 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 1rTwIK-0008pG-7g for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 28 Jan 2024 04:57:20 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rTwHx-0003uX-Gl; Sat, 27 Jan 2024 22:56:57 -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 1rTwHv-0003uJ-O8 for bug-gnu-emacs@gnu.org; Sat, 27 Jan 2024 22:56:55 -0500 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rTwHv-0005LJ-5R for bug-gnu-emacs@gnu.org; Sat, 27 Jan 2024 22:56:55 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1rTwI2-00080L-8Q for bug-gnu-emacs@gnu.org; Sat, 27 Jan 2024 22:57:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Yuan Fu Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 28 Jan 2024 03:57:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 68652 X-GNU-PR-Package: emacs Original-Received: via spool by 68652-submit@debbugs.gnu.org id=B68652.170641418230708 (code B ref 68652); Sun, 28 Jan 2024 03:57:02 +0000 Original-Received: (at 68652) by debbugs.gnu.org; 28 Jan 2024 03:56:22 +0000 Original-Received: from localhost ([127.0.0.1]:56249 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rTwHO-0007zC-1f for submit@debbugs.gnu.org; Sat, 27 Jan 2024 22:56:22 -0500 Original-Received: from mail-oi1-x230.google.com ([2607:f8b0:4864:20::230]:53285) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rTwHJ-0007yw-Vy for 68652@debbugs.gnu.org; Sat, 27 Jan 2024 22:56:20 -0500 Original-Received: by mail-oi1-x230.google.com with SMTP id 5614622812f47-3bb9d54575cso1460844b6e.2 for <68652@debbugs.gnu.org>; Sat, 27 Jan 2024 19:56:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1706414165; x=1707018965; darn=debbugs.gnu.org; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=G3RgxymqLI3LT1HiKvrZqhlXbZbBwpqsLf7EsCs4sJQ=; b=gEgSoZWknHr8gD3xpM5sYQBUKtGVg2YTpJIJNszJY+n4EDMm84YrW2WXuoj0GzkQlU ccWnekQD7jpFsAsjtLFjo32MrtoRlIObgldPX+iplP/0a8D1K05tNw8Ub6uRNxnro99W XzcdxjUAHStHJcMx6g1xWMzmjF1al+6nuE12KVxZ/vpgYD7Rqr1LXfa5HCLn9Bc72F30 AVDJ8XpSXCGjK+ZOCDy+JCe7/PqQRx7Tho/S+e6PK3xOR+B2irAEhncKG+QueO/U7Gnp bRFUXpz7Xdjy2HdixIHg2igW8k1EjzS5aej/5QAevMMUW4ZS02INliMsC/cwNu4qix6q qorQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706414165; x=1707018965; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=G3RgxymqLI3LT1HiKvrZqhlXbZbBwpqsLf7EsCs4sJQ=; b=YtvLIV1Tn9nNZyMo9jqiCOQUV5MgL6kd/xCxQJ9YTW6jcgdq4NSQ3U11x3vwqNN6dw kxPzbmIvFVidKfkJGAoS143ZzNOu5k21ZdPUW7OW4t2FaupQuS//rb7Jh0cZoaaCkYT0 X42KLHUjNKOUoq4gl0SgSXrJm+qDZk0ILZ6ToTklsv+h1JKvlIxJsOES3PODc37iOBXZ k1vPlSSp/cCHnCWU5rQIJgCE3dZcgdE9VhSddv6QI2lx8tdThYxGEOwntFvttm9zrpgo osxCNV/n4kZo4tb+3GXL7qDQMi9aZcB02GWbAQkjRdpPO+6coQ81dqNS/l1S/PeMWam+ M9dA== X-Gm-Message-State: AOJu0YzRBt47E3UJBfWaP9Ba9yOpatFguSOMS2j/ZqIQXQTFMH3ML9dn JZ699INU88f+GaoBDe7GnkRrQWgR0BxFH2eTcm5H49f/HrUnvhGb X-Google-Smtp-Source: AGHT+IG/Cj9Hgr7j5yZgqhfcnaDzZc5BIQ3z4O5VCE5xof/KlHveuFCJB+aeUDgJiaIxxLROpLVS6w== X-Received: by 2002:a05:6808:21a1:b0:3bd:db50:34df with SMTP id be33-20020a05680821a100b003bddb5034dfmr3812564oib.31.1706414164770; Sat, 27 Jan 2024 19:56:04 -0800 (PST) Original-Received: from smtpclient.apple (172-117-161-177.res.spectrum.com. [172.117.161.177]) by smtp.gmail.com with ESMTPSA id it3-20020a056a00458300b006db04fb3f00sm3461658pfb.28.2024.01.27.19.56.03 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sat, 27 Jan 2024 19:56:04 -0800 (PST) In-Reply-To: <86h6iz83fg.fsf@gnu.org> X-Mailer: Apple Mail (2.3731.700.6) 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:279050 Archived-At: > On Jan 27, 2024, at 2:40 AM, Eli Zaretskii wrote: >=20 >> From: Troy Brown >> Date: Sun, 21 Jan 2024 23:47:08 -0500 >>=20 >> I've noticed that "defun" related treesit commands/functions do not >> appear to work correctly near the beginning of a function. I've seen >> this behavior in multiple languages and believe the problem is an = issue >> in the treesit.el library. Also, I believe the issue occurs on the >> first token of the function definition. The following example uses >> c-ts-mode to demonstrate the issue. >>=20 >> --8<---------------cut here---------------start------------->8--- >> // -*- mode: c-ts -*- >>=20 >> void previous (void); >> void next (void); >>=20 >> void previous (void) { >> } >>=20 >> void main (void) { >> previous(); >> next(); >> printf("Hello, world!\n"); >> } >>=20 >> void next (void) { >> } >> --8<---------------cut here---------------end--------------->8--- >>=20 >> To reproduce the issue, place point between the "o" and "i" of the >> "void" return type for the "main" function. When point is at this >> location, I've noticed incorrect behavior for the following commands: >>=20 >> M-x treesit-beginning-of-defun RET >>=20 >> Moves point to the beginning of the previous function instead of the >> beginning of the current (i.e., "main") function. >>=20 >> M-x treesit-end-of-defun RET >>=20 >> This does not move point, when it should move to the end of the = current >> function. >>=20 >> I've also noticed functions, such as "treesit-defun-at-point" behave >> incorrectly here as well (i.e., returns "nil" instead of the function >> definition node). >=20 > This seems to be already fixed on the master branch, so I think we can > close this bug. >=20 > Yuan, any comments? I just tried it and yeah it=E2=80=99s fixed on master. I couldn=E2=80=99t = find which commit fixed it though=E2=80=A6=20 Yuan=