Function: combobulate-transpose-sexps

combobulate-transpose-sexps is an interactive and natively compiled function defined in combobulate-manipulation.el.

Signature

(combobulate-transpose-sexps)

Documentation

Transpose sexp-like nodes around point.

If there are no legitimate sexp nodes around point, fall back to M-x transpose-sexp (transpose-sexp).

Key Bindings

combobulate-key-map C-M-t

Source Code

;; Defined in /nix/store/b5fvrwzi3zvkabyzx0in6gw1cj963z46-emacs-packages-deps/share/emacs/site-lisp/combobulate-manipulation.el
(defun combobulate-transpose-sexps ()
  "Transpose sexp-like nodes around point.

If there are no legitimate sexp nodes around point, fall back to
\\[transpose-sexp]."
  (interactive)
  ;; this covers the most common case where two nodes are "adjacent"
  ;; to the point.
  (if-let ((backward-node (combobulate-transpose-sexps-1 t))
           (forward-node (combobulate-transpose-sexps-1 nil)))
      (progn
        (combobulate--goto-node forward-node t)
        (save-excursion
          (combobulate--swap-node-regions backward-node forward-node)))
    ;; for everything else, fall back to the normal (but augmented,
    ;; because `combobulate-forward-sexp-function' is used by
    ;; `transpose-sexps') to attempt a transposition by shifting
    ;; point around.
    (transpose-sexps 1 t)))