Skip to content

Commit

Permalink
[Fix #192] Clean ns understands $ as a symbol
Browse files Browse the repository at this point in the history
  • Loading branch information
benedekfazekas committed May 31, 2017
1 parent 0e84aec commit e0fde50
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
* [clojure-emacs/clj-refactor.el#330](https://github.com/clojure-emacs/clj-refactor.el/issues/330) `clean-ns` ignores namespaced keywords.
* [#160](https://github.com/clojure-emacs/refactor-nrepl/issues/160) Make `resolve-missing` find newly defined vars and types (clj). Because of a stale cache, newly added vars or types would not be found. This fix takes into account vars/types added by eval-ing code (rescan affected namespace), and by hotloading dependencies (reset the cache).
* [clojure-emacs/clj-refactor.el#362](https://github.com/clojure-emacs/clj-refactor.el/issues/362) Preserve all shorthand style metadata when `clean-ns` is used.
* [#192](https://github.com/clojure-emacs/refactor-nrepl/issues/192) Clean ns understands `$` as a symbol. Specially this enables clean ns to work with incanter that does have function named `$`.

### Changes

Expand Down
3 changes: 2 additions & 1 deletion project.clj
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@
:filespecs [{:type :bytes :path "refactor-nrepl/refactor-nrepl/project.clj" :bytes ~(slurp "project.clj")}]
:profiles {:provided {:dependencies [[cider/cider-nrepl "0.10.0"]
[org.clojure/clojure "1.7.0"]]}
:test {:dependencies [[print-foo "1.0.1"]]
:test {:dependencies [[print-foo "1.0.1"]
[incanter/incanter-core "1.5.7"]]
:src-paths ["test/resources"]}
:1.8 {:dependencies [[org.clojure/clojure "1.8.0"]]}
:1.9 {:dependencies [[org.clojure/clojure "1.9.0-alpha14"]
Expand Down
2 changes: 1 addition & 1 deletion src/refactor_nrepl/core.clj
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@
(= "/" fully-qualified-name)
fully-qualified-name

(re-find #"\$" fully-qualified-name)
(re-find #"\w\$\w" fully-qualified-name)
(let [[outer & classes] (-> fully-qualified-name (.split "\\$"))
outer (suffix outer)]
(if (> (count classes) 1)
Expand Down
6 changes: 6 additions & 0 deletions test/refactor_nrepl/ns/clean_ns_test.clj
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@

(def ns-with-multiple-shorthand-meta (clean-msg "test/resources/ns_with_multiple_shorthand_meta.clj"))

(def ns-with-incanter (clean-msg "test/resources/ns_with_incanter.clj"))

(deftest combines-requires
(let [requires (core/get-ns-component (clean-ns ns2) :require)
combined-requires (core/get-ns-component ns2-cleaned :require)]
Expand Down Expand Up @@ -199,3 +201,7 @@
(let [cleaned (pprint-ns (clean-ns ns-with-multiple-shorthand-meta))]
(is (re-find #"\^:automation" cleaned))
(is (re-find #"\^:multiple" cleaned))))

(deftest does-not-remove-dollar-sign-if-valid-symbol
(let [cleaned (pprint-ns (clean-ns ns-with-incanter))]
(is (re-find #"\[\$\]" cleaned))))

0 comments on commit e0fde50

Please sign in to comment.