Fix beginning/end-of-defun with tree-sitter
* lisp/treesit.el (treesit-beginning-of-defun) (treesit-end-of-defun): Push mark, as other beginning/end-of-defun functions do.
This commit is contained in:
parent
e205f68717
commit
910a7b30df
1 changed files with 8 additions and 0 deletions
|
@ -1862,6 +1862,10 @@ This is a tree-sitter equivalent of `beginning-of-defun'.
|
||||||
Behavior of this function depends on `treesit-defun-type-regexp'
|
Behavior of this function depends on `treesit-defun-type-regexp'
|
||||||
and `treesit-defun-skipper'."
|
and `treesit-defun-skipper'."
|
||||||
(interactive "^p")
|
(interactive "^p")
|
||||||
|
(or (not (eq this-command 'treesit-beginning-of-defun))
|
||||||
|
(eq last-command 'treesit-beginning-of-defun)
|
||||||
|
(and transient-mark-mode mark-active)
|
||||||
|
(push-mark))
|
||||||
(let ((orig-point (point))
|
(let ((orig-point (point))
|
||||||
(success nil))
|
(success nil))
|
||||||
(catch 'done
|
(catch 'done
|
||||||
|
@ -1892,6 +1896,10 @@ this function depends on `treesit-defun-type-regexp' and
|
||||||
(interactive "^p\nd")
|
(interactive "^p\nd")
|
||||||
(let ((orig-point (point)))
|
(let ((orig-point (point)))
|
||||||
(if (or (null arg) (= arg 0)) (setq arg 1))
|
(if (or (null arg) (= arg 0)) (setq arg 1))
|
||||||
|
(or (not (eq this-command 'treesit-end-of-defun))
|
||||||
|
(eq last-command 'treesit-end-of-defun)
|
||||||
|
(and transient-mark-mode mark-active)
|
||||||
|
(push-mark))
|
||||||
(catch 'done
|
(catch 'done
|
||||||
(dotimes (_ 2) ; Not making progress is better than infloop.
|
(dotimes (_ 2) ; Not making progress is better than infloop.
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue