uld we use a `transpose-sexp-function` variable, which `treesit` can >>then set, so `simple.el` doesn't need to know about `treesit` at all? >> > > Yes absolutely! I'll make that change. It makes sense, because we need not really rely on forward-foo anyways:) > >>> (defun transpose-lines (arg) >>> @@ -8521,6 +8524,9 @@ transpose-subr >>> (progn (funcall mover (- x)) (point)))))) >>> pos1 pos2) >>> (cond >>> + ((treesit-parser-list) >>> + (cl-multiple-value-bind (p1 p2) (funcall aux arg) >>> + (transpose-subr-1 p1 p2))) >>> ((= arg 0) >>> (save-excursion >>> (setq pos1 (funcall aux 1)) >> >>Please use `pcase-let` instead of `cl-multiple-value-bind` (especially >>since you use it to decompose something built with `list` rather than >>with `cl-values`). >> >>Also to avid re-testing `treesit-parser-list`, I'd recommend you extend >>the semantics of `mover` so it can either return a position (the old >>protocol) or directly return a pair of positions. You could even add >>a 3rd kind of return value to explicitly trigger the error message >>instead of relying on the (cons 0 1) hack. >> >> >> Stefan >> > > Yeah! I believe this either wasn't the latest patch, or i forgot to > send it. I'll see what lies around my system and wrap things up. What do you think about something like this? It feels a little iffy how to handle the separate return values, but it works. I'd be super happy for some feedback on how to best solve that, though :) Also, I made the treesit-transpose-sexps a little better imo, in that we only find named nodes to swap, but use every available node for the entry. We rarely, if ever want to swap the unnamed nodes. Theo