From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Troy Brown Newsgroups: gmane.emacs.bugs Subject: bug#68652: 29.1.50; treesit defun commands broken near beginning of function Date: Sun, 21 Jan 2024 23:47:08 -0500 Message-ID: Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="27904"; mail-complaints-to="usenet@ciao.gmane.io" To: 68652@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Mon Jan 22 05:48:30 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 1rRmEY-00077n-0x for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 22 Jan 2024 05:48:30 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rRmE4-0001le-Hn; Sun, 21 Jan 2024 23:48:00 -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 1rRmE2-0001lF-Ml for bug-gnu-emacs@gnu.org; Sun, 21 Jan 2024 23:47:58 -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 1rRmE2-0001rX-F8 for bug-gnu-emacs@gnu.org; Sun, 21 Jan 2024 23:47:58 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1rRmE5-0004qJ-UV for bug-gnu-emacs@gnu.org; Sun, 21 Jan 2024 23:48:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Troy Brown Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 22 Jan 2024 04:48:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 68652 X-GNU-PR-Package: emacs X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.170589885918466 (code B ref -1); Mon, 22 Jan 2024 04:48:01 +0000 Original-Received: (at submit) by debbugs.gnu.org; 22 Jan 2024 04:47:39 +0000 Original-Received: from localhost ([127.0.0.1]:39661 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rRmDj-0004nl-0A for submit@debbugs.gnu.org; Sun, 21 Jan 2024 23:47:39 -0500 Original-Received: from lists.gnu.org ([2001:470:142::17]:42714) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rRmDf-0004nQ-5U for submit@debbugs.gnu.org; Sun, 21 Jan 2024 23:47:37 -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 1rRmDU-0001h8-E0 for bug-gnu-emacs@gnu.org; Sun, 21 Jan 2024 23:47:25 -0500 Original-Received: from mail-ed1-f41.google.com ([209.85.208.41]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rRmDS-0001fi-AW for bug-gnu-emacs@gnu.org; Sun, 21 Jan 2024 23:47:23 -0500 Original-Received: by mail-ed1-f41.google.com with SMTP id 4fb4d7f45d1cf-55a8fb31fc2so1416457a12.0 for ; Sun, 21 Jan 2024 20:47:21 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1705898840; x=1706503640; h=to:subject:message-id:date:from:mime-version:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=FzEuIDtoQnGCspEq7fFan/o+jF2YagZD/tkV6+BlgVs=; b=ck7e6vTPA1xSm13/OyQ8V/neDCvt4OiDMZ8upUU3ZfQZcA445Y0Ij+prrmzhkn880/ KA+NAEyywFLpCEpaqnXnbySfBQFrs19+m1v7PJWi6ww9qAdxpW7AeCkVyoaI6bfhABVd M9tp88QBuYFKW73PwGipvqUaobZHXcLbX2sHRkuMJdUqCKVZ6hBAf1nF/Ps4EOZf3nCz 765t25C9LRpvEusFf0aAiggGrLEOPhaZhWKVr0+pBj1I5bM/w8xpwkABAHUyYGDm/l13 YO6p6v8tGv1b2FGuBNwMeEiNkZI3PP7VLzA75IGM2LdObgtOV/7wp4+uVplcvoMLAZsa +n0w== X-Gm-Message-State: AOJu0YyRkPX+J+TvW5tgEJadEwaJ1xVpUXJbENv0RjHOjqOQyhYOr201 iXynvINZNBefi8Aokp7kO/5xg9ZKZf26/f3D4+5GuWCK+UGG/GaxOUAgmBY7FVE= X-Google-Smtp-Source: AGHT+IFLJYk7gIio4xE1dnNBWm8shgspNA74SYPgoJWG+n7vStoqkKYDfhUgGVa4nL26BSpubiOJ+A== X-Received: by 2002:aa7:cb4b:0:b0:558:c044:e860 with SMTP id w11-20020aa7cb4b000000b00558c044e860mr2046468edt.69.1705898840159; Sun, 21 Jan 2024 20:47:20 -0800 (PST) Original-Received: from mail-ed1-f46.google.com (mail-ed1-f46.google.com. [209.85.208.46]) by smtp.gmail.com with ESMTPSA id fk4-20020a056402398400b005576a384b46sm13751942edb.10.2024.01.21.20.47.19 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 21 Jan 2024 20:47:19 -0800 (PST) Original-Received: by mail-ed1-f46.google.com with SMTP id 4fb4d7f45d1cf-55a8fb31fc2so1416444a12.0 for ; Sun, 21 Jan 2024 20:47:19 -0800 (PST) X-Received: by 2002:aa7:c351:0:b0:559:eee7:e99 with SMTP id j17-20020aa7c351000000b00559eee70e99mr1573977edr.31.1705898839462; Sun, 21 Jan 2024 20:47:19 -0800 (PST) X-Gmail-Original-Message-ID: Received-SPF: pass client-ip=209.85.208.41; envelope-from=troy.s.brown@gmail.com; helo=mail-ed1-f41.google.com X-Spam_score_int: -13 X-Spam_score: -1.4 X-Spam_bar: - X-Spam_report: (-1.4 / 5.0 requ) BAYES_00=-1.9, FREEMAIL_FORGED_FROMDOMAIN=0.249, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.249, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no autolearn_force=no X-Spam_action: no action 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:278686 Archived-At: 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. --8<---------------cut here---------------start------------->8--- // -*- mode: c-ts -*- void previous (void); void next (void); void previous (void) { } void main (void) { previous(); next(); printf("Hello, world!\n"); } void next (void) { } --8<---------------cut here---------------end--------------->8--- 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: M-x treesit-beginning-of-defun RET Moves point to the beginning of the previous function instead of the beginning of the current (i.e., "main") function. M-x treesit-end-of-defun RET This does not move point, when it should move to the end of the current function. 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).