[ANN] clj-refactor.el 1.1.0 is released

282 views
Skip to first unread message

Magnar Sveen

unread,
Jul 6, 2015, 9:35:11 AM7/6/15
to clo...@googlegroups.com

Since the last announcement of clj-refactor in this group, there's been a flurry of activity. Lars Andersen and Benedek Fazekas have been hard at work with the editor-agnostic refactor-nrepl package, which was spawned out of clj-refactor.el. I'm happy to say that there are now refactorings in both Light Table and vim available based on this effort.

As for clj-refactor, the latest releases have brought a lot of new features - here are some highlights:

  • Add project dependency gives you a list of artifacts on Clojars, lets you select version and adds it to your project.clj, then hotloads the dependency into your REPL. demo

  • Add missing libspec finds the symbol at point in your classpath, and adds the proper require statement to your namespace. demo

  • Find usages opens a grep-like buffer with all usages of the symbol at point. demo

  • Rename symbol renames all occurences of the symbol at point, in your project. demo

  • Clean namespace

    • Eliminates :use clauses in favor of refer :all.
    • Sorts required libraries, imports and vectors of referred symbols
    • Raises errors if any inconsistencies are found (e.g. a libspec with more than one alias).
    • Removes any duplication in the :require and :import form.
    • Removes any unused libspec vectors
    • Removes unused symbols from the :refer vector, or removes it completely.
    • Removes any unused imports
    • Optionally rewrites to favor prefix form, e.g. [clojure [string test]] instead of two separate libspecs demo
  • Extract function extracts the form at point, or the nearest enclosing form, into a toplevel defn.demo

  • Inline symbol replaces the symbol at point with its definition. Removes empty lets afterwards.demo

  • Add stubs adds a skeleton implementation of the protocol or interface at point. demo

And a whole bunch more. See everything clj-refactor has to offer.

Thanks to all the contributors, and especially to Lars and Ben!

Ed Maphis

unread,
Jul 6, 2015, 6:08:26 PM7/6/15
to clo...@googlegroups.com

Thanks to all the contributers, along with Cider, this is great software


Andrea Richiardi

unread,
Jul 7, 2015, 5:34:44 AM7/7/15
to clo...@googlegroups.com


On Monday, 6 July 2015 15:35:11 UTC+2, Magnar Sveen wrote:

Since the last announcement of clj-refactor in this group, there's been a flurry of activity. Lars Andersen and Benedek Fazekas have been hard at work with the editor-agnostic refactor-nrepl package, which was spawned out of clj-refactor.el. I'm happy to say that there are now refactorings in both Light Table and vim available based on this effort.

Good job guys!

Tassilo Horn

unread,
Jul 7, 2015, 6:03:45 AM7/7/15
to Magnar Sveen, clo...@googlegroups.com
Magnar Sveen <mag...@gmail.com> writes:

Hi Magnar,

> Since the last announcement of clj-refactor in this group, there's been a
> flurry of activity.

I've just started using it. Especially being able to rename locals and
clean up namespace declarations is awesome so thanks for the great work!

I've sometimes encountered some quirks where it performed the
replacement for renamed locals at slightly off positions (after
switching to refactor-nrepl "1.2.0-SNAPSHOT" from 1.1.0 it seems to
occur less often), though, and I frequently (after every refactoring it
seems) I get errors about bad namespaces (although different ones than
those where I performed the refactorings).

The error messaged in emacs is this:

--8<---------------cut here---------------start------------->8---
error in process filter: user-error: Some namespaces are in a bad state:
error "Class not found: String" in funnyqt.xmltg-test;
error "Class not found: String" in funnyqt.tg-test;
error "Class not found: String" in funnyqt.coevo.tg;
error "Class not found: String" in funnyqt.bidi
--8<---------------cut here---------------end--------------->8---

I've just checked the funnyqt.xmltg-test namespace, and there's no
single occurrence of String at all. Is there any way to get some more
information on what causes the hickup? Apparently, these namespaces are
all correct (at least they compile and the tests succeed). So if I
could isolate somehow the problematic stuff I'd file an issue with some
minimal example (I guess that would go to refactor-nrepl, right?).

Bye,
Tassilo

Magnar Sveen

unread,
Jul 7, 2015, 6:17:11 AM7/7/15
to clo...@googlegroups.com
Hi Tassilo. Please report this issue on our tracker! https://github.com/clojure-emacs/clj-refactor.el/issue

Tassilo Horn

unread,
Jul 7, 2015, 7:39:52 AM7/7/15
to Magnar Sveen, clo...@googlegroups.com
Magnar Sveen <mag...@gmail.com> writes:

> Hi Tassilo. Please report this issue on our tracker!
> https://github.com/clojure-emacs/clj-refactor.el/issue

Done so: https://github.com/clojure-emacs/clj-refactor.el/issues/184

Bye,
Tassilo
Reply all
Reply to author
Forward
0 new messages