bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#59677: 30.0.50; Error when calling (treesit-end-of-defun)


From: Yuan Fu
Subject: bug#59677: 30.0.50; Error when calling (treesit-end-of-defun)
Date: Thu, 1 Dec 2022 21:17:44 -0800

Daniel Martín <mardani29@yahoo.es> writes:

> Daniel Kraus <daniel@kraus.my> writes:
>
>> Hi,
>>
>> I tried the latest -ts-modes and ran into a problem with the
>> symbol-overlay ( https://github.com/wolray/symbol-overlay )
>> package.
>>
>> The problem is that `(end-of-defun)` calls `(treesit-end-of-defun)`
>> when in a ...-ts-mode and this function seems to raise an error when
>> point is not inside a function.
>>
>> Steps to reproduce:
>> - emacs -Q
>> - find-file "foo.py"
>> - Then if you run `M-: (end-of-defun)` it works as expected.
>> - After switching to `M-x python-ts-mode`,
>>   the same command raises an error.
>
> The error is signaled by the goto-char call in treesit-end-of-defun.
> Protecting it from possible nil node positions fixes the issue for me
> (there is a similar check in treesit-beginning-of-defun):
>

Thanks, I applied this patch. Tho technically end-of-defun shouldn’t
call end-of-defun-function unless point is on the beginning of a defun.
So we should really fix end-of-defun instead. I tried to fix it earlier
but that fix didn’t cover all cases where we call end-of-defun-function.

Anyway, I applied the patch and this particular problem should be gone
now :-)

Yuan





reply via email to

[Prev in Thread] Current Thread [Next in Thread]