简体   繁体   中英

Paredit and transpose code blocks

If I have the following s-expression:

(if true (this) (that))

And I want:

(if true (that) (this))

How does paredit helps to transpose (this) and (that) ?

I don't know what "paredit" is, but in stock Emacs you can place the point between (this) and (that) and hit CMt which runs the command transpose-sexps :

Like Ct ( transpose-chars ), but applies to sexps.

Unlike transpose-words , point must be between the two sexps and not in the middle of a sexp to be transposed.

With non-zero prefix arg ARG, effect is to take the sexp before point and drag it forward past ARG other sexps (backward if ARG is negative). If ARG is zero, the sexps ending at or after point and at or after mark are interchanged.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM