user12341234
user12341234

Reputation: 7223

Editing commands to switch to threading macro in evil-cleverparens/clojure

I've been using emacs/evil/cider for a while and finally want to make the plunge into a paredit like environment. I'm trying evil-cleverparens, though imagine this concept applies to any sexp-editor/mode.

Say I have a nested sexp (a (b (c d))) and I want to switch it over to use a threading macro (->> d c b a). What editing commands can I use to streamline this process?

Upvotes: 0

Views: 64

Answers (1)

Thomas Wright
Thomas Wright

Reputation: 106

You could do this in vanilla paredit-mode:

(a (b (c| d))) C-M-t (transpose-sexps) (a (b (d| c))) C-M-u (paredit-backward-up) (a (b |(d c))) C-M-t (transpose-sexps) (a ((d c) |b)) C-M-u (paredit-backward-up) (a |((d c) b)) C-M-t (transpose-sexps) (((d c) b) |a) C-M-p (paredit-backward-down) (((d c) b|) a) C-M-p (paredit-backward-down) (((d c|) b) a) M-s (paredit-splice-sexp) ((d c| b) a) M-s (paredit-splice-sexp) (d c| b a)

Upvotes: 1

Related Questions