all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Yuan Fu <casouri@gmail.com>
To: Eli Zaretskii <eliz@gnu.org>
Cc: 68652@debbugs.gnu.org, Troy Brown <brownts@troybrown.dev>
Subject: bug#68652: 29.1.50; treesit defun commands broken near beginning of function
Date: Sat, 27 Jan 2024 19:55:52 -0800	[thread overview]
Message-ID: <EE6EB64E-8260-4CC7-8B9D-B423D6B4261A@gmail.com> (raw)
In-Reply-To: <86h6iz83fg.fsf@gnu.org>


> On Jan 27, 2024, at 2:40 AM, Eli Zaretskii <eliz@gnu.org> wrote:
> 
>> From: Troy Brown <brownts@troybrown.dev>
>> Date: Sun, 21 Jan 2024 23:47:08 -0500
>> 
>> 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).
> 
> This seems to be already fixed on the master branch, so I think we can
> close this bug.
> 
> Yuan, any comments?

I just tried it and yeah it’s fixed on master. I couldn’t find which commit fixed it though… 

Yuan




  reply	other threads:[~2024-01-28  3:55 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-22  4:47 bug#68652: 29.1.50; treesit defun commands broken near beginning of function Troy Brown
2024-01-27 10:40 ` Eli Zaretskii
2024-01-28  3:55   ` Yuan Fu [this message]
2024-01-28  6:49     ` Eli Zaretskii

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=EE6EB64E-8260-4CC7-8B9D-B423D6B4261A@gmail.com \
    --to=casouri@gmail.com \
    --cc=68652@debbugs.gnu.org \
    --cc=brownts@troybrown.dev \
    --cc=eliz@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.