mirror of
git://git.sv.gnu.org/emacs.git
synced 2026-01-25 05:52:42 -08:00
; Handle nil ARG in treesit-beginning/end-of-defun
* lisp/treesit.el (treesit-beginning-of-defun) (treesit-end-of-defun): Handle nil ARG.
This commit is contained in:
parent
1a66435dda
commit
3d348c46e7
1 changed files with 4 additions and 2 deletions
|
|
@ -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))))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue