As you may remember, one of the commands I like the most from the clj-refactor
package are the ones that thread and unwind Clojure code forms for you. Now that
Emacs is also getting built-in threading macros, I figured the best way to give
them a fair chance in life is to also make them pretty convenient to use.
The point here is that you can place point before a paren, invoke a command, and
a regular code form gets transformed into a threading macro, or vice-versa. See
the linked post for what that means. Instead of writing whole new commands for
that, I had a fun time just hacking clj-refactor commands to work on
thread-first/last.
It should go without saying, you need clj-refactor installed for this to work.
Maybe just writing it from scratch would have made for shorter code (it would
certainly be more robust). But such is life. I try not to dwell too much on
quick hacks.
Commands to thread and unwind code in Emacs-Lisp
01 Mar 2016, by Artur Malabarba.As you may remember, one of the commands I like the most from the
clj-refactor
package are the ones that thread and unwind Clojure code forms for you. Now that Emacs is also getting built-in threading macros, I figured the best way to give them a fair chance in life is to also make them pretty convenient to use.The point here is that you can place point before a paren, invoke a command, and a regular code form gets transformed into a threading macro, or vice-versa. See the linked post for what that means. Instead of writing whole new commands for that, I had a fun time just hacking
clj-refactor
commands to work onthread-first/last
.It should go without saying, you need clj-refactor installed for this to work.
Maybe just writing it from scratch would have made for shorter code (it would certainly be more robust). But such is life. I try not to dwell too much on quick hacks.
Tags: programming, convenience, init.el, emacs,
Conditional breakpoints in the CIDER Debugger »
« New in Emacs 25.1: More flow control macros
Related Posts
Turbo up your Ruby console in Emacs in programming
A quick guide to directory-local (or project-specific) variables in convenience
A few paredit keys that take over the world in programming
Content © 2019, All rights reserved. Icons under CC3.0.