; * lisp/treesit.el (treesit-end-of-defun): Guard against nil value.
This commit is contained in:
parent
2c4d92d30f
commit
520a4e12f8
1 changed files with 6 additions and 1 deletions
|
@ -1614,7 +1614,12 @@ ARG is the same as in `beginning-of-defun'."
|
||||||
(let* ((node (treesit-search-forward
|
(let* ((node (treesit-search-forward
|
||||||
(treesit-node-at (point)) treesit-defun-type-regexp t t))
|
(treesit-node-at (point)) treesit-defun-type-regexp t t))
|
||||||
(top (treesit--defun-maybe-top-level node)))
|
(top (treesit--defun-maybe-top-level node)))
|
||||||
(goto-char (treesit-node-end top))))
|
;; Technically `end-of-defun' should only call this function when
|
||||||
|
;; point is at the beginning of a defun, so TOP should always be
|
||||||
|
;; non-nil, but things happen, and we want to be safe, so check
|
||||||
|
;; for TOP anyway.
|
||||||
|
(when top
|
||||||
|
(goto-char (treesit-node-end top)))))
|
||||||
|
|
||||||
;;; Activating tree-sitter
|
;;; Activating tree-sitter
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue