Refactor Clojure Code

Common refactoring, such as changing names, can be done with the Evil tools, iedit, narrowing and helm-ag. These have been covered previously in the Evil tools section.

Specific examples of using evil tools for refactoring Clojure code:

Structural editing via the SPC k lisp state uses smartparens to alter the your code whist respecting the structure, as defined by parens, [ ] { } ( ) and even " ". Smartparens works for all languages, although is most useful with lisp syntax.

Clojure specific refactor commands are in the clojure mode refactor menu, , r provided by the package clj-refactor. These refactor commands are very rarely used as the commands already mentioned allow you to do a huge amount of refactoring quickly.

Refactor Approach Usage
narrowing refactor in function on region (usually with iedit)
iedit refactor in current namespace
helm-ag project wide refactor (usually with iedit)
lisp state A state for smartparents structural editing
clj-refactor , r for clojure specific refactor commands (optional package in Clojure layer)

Add example video of refactoring

Add a video with some common examples of refactoring in action. Here is a general Emacs and clj-refactor example in the mean time

results matching ""

    No results matching ""