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: Daniel Kraus
Subject: bug#59677: 30.0.50; Error when calling (treesit-end-of-defun)
Date: Tue, 29 Nov 2022 13:35:57 +0100

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

> 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):
>
> diff --git a/lisp/treesit.el b/lisp/treesit.el
> index 8f092f475d..45a4d3c764 100644
> --- a/lisp/treesit.el
> +++ b/lisp/treesit.el
> @@ -1614,7 +1614,9 @@ treesit-end-of-defun
>    (let* ((node (treesit-search-forward
>                  (treesit-node-at (point)) treesit-defun-type-regexp t t))
>           (top (treesit--defun-maybe-top-level node)))
> -    (goto-char (treesit-node-end top))))
> +    (when top
> +      (goto-char (treesit-node-end top))
> +      t)))
>
>  ;;; Activating tree-sitter
>

Thanks.
This patch fixes the bug for me :)

Cheers,
  Daniel





reply via email to

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