Paredit 和转置代码块
Paredit and transpose code blocks
如果我有以下s-expression:
(if true (this) (that))
我想要:
(if true (that) (this))
paredit 如何帮助转置 (this)
和 (that)
?
我不知道 "paredit" 是什么,但是有现货 Emacs,您可以将
点在 (this)
和 (that)
之间并点击 C-M-t 运行
命令 transpose-sexps
:
Like C-t (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.
如果我有以下s-expression:
(if true (this) (that))
我想要:
(if true (that) (this))
paredit 如何帮助转置 (this)
和 (that)
?
我不知道 "paredit" 是什么,但是有现货 Emacs,您可以将
点在 (this)
和 (that)
之间并点击 C-M-t 运行
命令 transpose-sexps
:
Like C-t (
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.