From 5e85e6e23f6dde43fc6433bed819c6d9f827007c Mon Sep 17 00:00:00 2001 From: Theodor Thornhill Date: Fri, 2 Dec 2022 21:40:50 +0100 Subject: [PATCH] Make treesit-end-of-defun handle nil node * lisp/treesit.el (treesit-end-of-defun): Change from 'let*' to 'when-let*'. --- lisp/treesit.el | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lisp/treesit.el b/lisp/treesit.el index 0de0e283c3..e0949d7328 100644 --- a/lisp/treesit.el +++ b/lisp/treesit.el @@ -1611,9 +1611,9 @@ treesit-end-of-defun "Tree-sitter `end-of-defun' function." ;; Why not simply get the largest node at point: when point is at ;; (point-min), that gives us the root node. - (let* ((node (treesit-search-forward - (treesit-node-at (point)) treesit-defun-type-regexp t t)) - (top (treesit--defun-maybe-top-level node))) + (when-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)))) ;;; Activating tree-sitter -- 2.34.1