From 603fa0c00eb0d6ec70690c56d17aa5014e1d1dd7 Mon Sep 17 00:00:00 2001 From: Juri Linkov Date: Wed, 29 Jan 2025 19:58:10 +0200 Subject: [PATCH] Fix args in treesit-beginning-of-defun and treesit-end-of-defun * lisp/treesit.el (treesit-beginning-of-defun): Set arg to 1 when nil. (treesit-end-of-defun): Fix arg names in docstring. (cherry picked from commit 6a92f674fe5123742b2c1bc890bab7b3743582c8) --- lisp/treesit.el | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lisp/treesit.el b/lisp/treesit.el index e05c74f4143..4cca074c304 100644 --- a/lisp/treesit.el +++ b/lisp/treesit.el @@ -2847,6 +2847,7 @@ not set, Emacs also looks for definition of defun in (let ((orig-point (point)) (success nil) (pred (or treesit-defun-type-regexp 'defun))) + (unless arg (setq arg 1)) (catch 'done (dotimes (_ 2) @@ -2866,8 +2867,8 @@ not set, Emacs also looks for definition of defun in (defun treesit-end-of-defun (&optional arg _) "Move forward to next end of defun. -With argument ARG, do it that many times. -Negative argument -N means move back to Nth preceding end of defun. +With argument ARG, do it that many times. Negative ARG means +move back to the ARGth preceding end of defun. This is a tree-sitter equivalent of `end-of-defun'. Behavior of this function depends on `treesit-defun-type-regexp' and -- 2.39.5