summaryrefslogtreecommitdiff
path: root/lisp
diff options
context:
space:
mode:
Diffstat (limited to 'lisp')
-rw-r--r--lisp/treesit.el6
1 files changed, 4 insertions, 2 deletions
diff --git a/lisp/treesit.el b/lisp/treesit.el
index 74476f18619..a5eda436c89 100644
--- a/lisp/treesit.el
+++ b/lisp/treesit.el
@@ -1635,7 +1635,8 @@ This is a tree-sitter equivalent of `beginning-of-defun'.
Behavior of this function depends on `treesit-defun-type-regexp'
and `treesit-defun-skipper'."
(interactive "^p")
- (when-let ((dest (treesit--navigate-defun (point) (- arg) 'beg)))
+ (when-let* ((arg (or arg 1))
+ (dest (treesit--navigate-defun (point) (- arg) 'beg)))
(goto-char dest)
(when treesit-defun-skipper
(funcall treesit-defun-skipper))
@@ -1651,7 +1652,8 @@ This is a tree-sitter equivalent of `end-of-defun'. Behavior of
this function depends on `treesit-defun-type-regexp' and
`treesit-defun-skipper'."
(interactive "^p\nd")
- (when-let ((dest (treesit--navigate-defun (point) arg 'end)))
+ (when-let* ((arg (or arg 1))
+ (dest (treesit--navigate-defun (point) arg 'end)))
(goto-char dest)
(when treesit-defun-skipper
(funcall treesit-defun-skipper))))