1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2024-12-11 09:20:51 +00:00

; Fix treesit--defuns-around

Now it doesn't move point.

* lisp/treesit.el (treesit--defuns-around): Wrap some code with
save-excursion.
This commit is contained in:
Yuan Fu 2022-12-20 21:21:48 -08:00
parent 05d8310fb5
commit 69123d4aa4
No known key found for this signature in database
GPG Key ID: 56E19BC57664A442

View File

@ -1657,10 +1657,13 @@ REGEXP and PRED are the same as in `treesit-defun-type-regexp'."
;; defun, in that case we want to use a node that's actually
;; before/after point.
(node-before (if (>= (treesit-node-start node) pos)
(treesit-search-forward-goto node "" t t t)
(save-excursion
(treesit-search-forward-goto node "" t t t))
node))
(node-after (if (<= (treesit-node-end node) pos)
(treesit-search-forward-goto node "" nil nil t)
(save-excursion
(treesit-search-forward-goto
node "" nil nil t))
node))
(result (list nil nil nil))
(pred (or pred (lambda (_) t))))