]> git.eshelyaron.com Git - emacs.git/commit
Add treesit-transpose-sexps (bug#60128)
authorTheodor Thornhill <theo@thornhill.no>
Sun, 25 Dec 2022 19:11:59 +0000 (20:11 +0100)
committerStefan Monnier <monnier@iro.umontreal.ca>
Wed, 28 Dec 2022 18:00:43 +0000 (13:00 -0500)
commit7e98b8a0fa67f51784024fac3199d774dfa77192
tree7677db3c9e7685f40f7bbd8b214350ceb0065396
parent7dc24fb611c72697b7d34ba2abce0a0abc972a6b
Add treesit-transpose-sexps (bug#60128)

We don't really need to rely on forward-sexp to define what to
transpose.  In tree-sitter we can consider siblings as "balanced
expressions", and swap them without doing any movement to calculate
where the siblings in question are.

* lisp/simple.el (transpose-sexps-function): New defvar-local.
(transpose-sexps): Use the new defvar-local if available.
(transpose-subr): Check whether the mover function returns a cons of
conses, then run transpose-subr-1 on the position-pairs.
* lisp/treesit.el (treesit-transpose-sexps): New function.
etc/NEWS
lisp/simple.el
lisp/treesit.el