From b1ef6a6ab06feaae26594206eaa9c93392353ab6 Mon Sep 17 00:00:00 2001 From: Theodor Thornhill Date: Wed, 18 May 2022 23:03:55 +0200 Subject: [PATCH] Add fallback value for arg Also, fix typo in docstring --- lisp/treesit.el | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lisp/treesit.el b/lisp/treesit.el index 3313168d66..761c7147a0 100644 --- a/lisp/treesit.el +++ b/lisp/treesit.el @@ -927,20 +927,20 @@ treesit-beginning-of-defun With ARG, do it that many times. Negative ARG means move forward to the ARGth following beginning of defun. Defun is defined -according to `treesit-defun-pattern'." +according to `treesit-defun-query'." (unless treesit-defun-query (error "Variable `treesit-defun-query' is unset")) - (treesit-search-beginning treesit-defun-query (- arg))) + (treesit-search-beginning treesit-defun-query (- (or arg 1)))) (defun treesit-end-of-defun (&optional arg) "Move forward to the end of a defun. With ARG, do it that many times. Negative ARG means move back to ARGth preceding end of defun. Defun is defined according to -`treesit-defun-pattern'." +`treesit-defun-query'." (unless treesit-defun-query (error "Variable `treesit-defun-query' is unset")) - (treesit-search-end treesit-defun-query arg)) + (treesit-search-end treesit-defun-query (or arg 1))) ;;; Debugging -- 2.25.1