3

I often need to swap s-expressions. How can I do that with paredit? I want to do things like the following:

(list |1 0)
(list 0 |1)

or:

(list 1 |0)
(list |0 1)
3
  • 5
    Emacs has a command for that by default, it's bound to C-M-t.
    – user12563
    Commented Sep 2, 2018 at 15:14
  • 1
    What @DoMiNeLa10 said. At least for the two simple examples you show, I see no need for paredit. Just put your cursor between two sexps and transpose them. (And use C-M-f or C-M-b to move forward/backward over sexps.) But different people use Emacs differently.
    – Drew
    Commented Sep 2, 2018 at 22:49
  • Thanks to both of you it works perfectly. Feel free to post an answer, so that I can select it. :)
    – Antoine
    Commented Sep 3, 2018 at 13:38

1 Answer 1

3

Emacs comes with such command out of the box, transpose-sexps. It's bound to C-M-t by default.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.