all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Daniel Kraus <daniel@kraus.my>
To: "Daniel Martín" <mardani29@yahoo.es>
Cc: 59677@debbugs.gnu.org
Subject: bug#59677: 30.0.50; Error when calling (treesit-end-of-defun)
Date: Tue, 29 Nov 2022 13:35:57 +0100	[thread overview]
Message-ID: <87v8myhr8e.fsf@kraus.my> (raw)
In-Reply-To: <m15yeyymgw.fsf@yahoo.es>


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	other threads:[~2022-11-29 12:35 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-29 11:08 bug#59677: 30.0.50; Error when calling (treesit-end-of-defun) Daniel Kraus
2022-11-29 12:27 ` Daniel Martín via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-11-29 12:35   ` Daniel Kraus [this message]
2022-12-02  5:17 ` Yuan Fu

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=87v8myhr8e.fsf@kraus.my \
    --to=daniel@kraus.my \
    --cc=59677@debbugs.gnu.org \
    --cc=mardani29@yahoo.es \
    /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.