Slam dunk! Looking forward to trying this out.

On Thursday, January 30, 2014 5:13:36 AM UTC-8, Magnar Sveen wrote:
>
> clj-refactor.el
> Since the last update, there's been lots of activity for 
> clj-refactor.el<https://github.com/magnars/clj-refactor.el>
> . Alex Baranosky <https://github.com/AlexBaranosky> and Lars 
> Andersen<https://github.com/expez> have 
> joined the team, and here are the new features:
> More let refactorings
>
> Starting with:
>
> (defn handle-request
>   (let [body (find-body abc)]
>     {:status 200
>      :body body})) 
>
> With the cursor in front of 200, I do cljr-move-to-let:
>
> (defn handle-request
>   (let [body (find-body abc)
>         X 200]
>     {:status X
>      :body body}))
>
> Again I have two cursors where the Xes are, so I type out the name, and 
> press enter:
>
> (defn handle-request
>   (let [body (find-body abc)
>         status 200]
>     {:status status
>      :body body}))
>
> Pretty handy. And it works with if-let and when-let too.
>
> *Thread first all, thread last all, unwind all*
>
> Convenience functions to thread all the way down, or unwind the entire 
> threading macro.
> Cycling Privacy
>
> Given this function:
>
> (defn add [a b]
>   (+ a b))
>
> I do cljr-cycle-privacy:
>
> (defn- add [a b]
>   (+ a b))
>
> I do cljr-cycle-privacy again to return to the original:
>
> (defn add [a b]
>   (+ a b))
>
> Given this def:
>
> (def config
>   "docs"
>   {:env "staging"})
>
> I do cljr-cycle-privacy:
>
> (def ^:private config
>   "docs"
>   {:env "staging"})
>
> I do cljr-cycle-privacy again to return to the original:
>
> (def config
>   "docs"
>   {:env "staging"})
>
> <https://github.com/magnars/clj-refactor.el#cycling-collection-type>Cycling 
> Collection Type
>
> Given this collection:
>
> (:a 1 :b 2)
>
> I do cljr-cycle-coll to return:
>
> {:a 1 :b 2}
>
> ... and then 3 more times:
>
> [:a 1 :b 2]#{:a 1 :b 2}(:a 1 :b 2)
>
>
> <https://github.com/magnars/clj-refactor.el#cycling-between-strings-and-keywords>Cycling
>  
> Between Strings and Keywords
>
> Given this string:
>
> "refactor"
>
> I do cljr-cycle-stringlike to return:
>
> :refactor
>
> ... and then 3 more times:
>
> "refactor":refactor"refactor"
>
> Thanks to Jay Fields <https://github.com/jaycfields> and 
> emacs-live<https://github.com/overtone/emacs-live> for 
> these cycling features. Good idea!
> Destructuring keys
>
> Given this:
>
> (defn- render-recommendation [rec]
>   (list [:h3 (:title rec)]
>         [:p (:by rec)]
>         [:p (:blurb rec) " "
>          (render-link (:link rec))]))
>
> I place the cursor on rec inside [rec] and do cljr-destructure-keys:
>
> (defn- render-recommendation [{:keys [title by blurb link]}]
>   (list [:h3 title]
>         [:p by]
>         [:p blurb " "
>          (render-link link)]))
>
> If rec had still been in use, it would have added an :as clause.
>
> For now this feature is limited to top-level symbols in a let form. PR 
> welcome.
> <https://github.com/magnars/clj-refactor.el#stop-referring>Stop referring
>
> Given this:
>
> (ns cljr.core
>   (:require [my.lib :as lib :refer [a b]]))
> (+ (a 1) (b 2))
>
> I place cursor on my.lib and do cljr-stop-referring:
>
> (ns cljr.core
>   (:require [my.lib :as lib]))
> (+ (lib/a 1) (lib/b 2))
>
> <https://github.com/magnars/clj-refactor.el#optional-setup>Even more
> There's also 
>
>    -  cljr-sort-ns to sort the namespace
>    -  cljr-replace-use to replace old :use statements with new :refer 
>    :all statements.
>    -  cljr-add-declaration to declare the defn you're in.
>
> So, clj-refactor.el still knows nothing about your code. At some point we 
> want to piggyback on an nrepl-connection to do the tricky parts of 
> refactoring, but for now we're happy to make life a little easier.
>
> Hope you enjoy!
>
>
>

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to