Skip to content

Commit e0fde50

Browse files
[Fix #192] Clean ns understands $ as a symbol
1 parent 0e84aec commit e0fde50

File tree

4 files changed

+10
-2
lines changed

4 files changed

+10
-2
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
* [clojure-emacs/clj-refactor.el#330](https://github.com/clojure-emacs/clj-refactor.el/issues/330) `clean-ns` ignores namespaced keywords.
1313
* [#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).
1414
* [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.
15+
* [#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 `$`.
1516

1617
### Changes
1718

project.clj

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@
2121
:filespecs [{:type :bytes :path "refactor-nrepl/refactor-nrepl/project.clj" :bytes ~(slurp "project.clj")}]
2222
:profiles {:provided {:dependencies [[cider/cider-nrepl "0.10.0"]
2323
[org.clojure/clojure "1.7.0"]]}
24-
:test {:dependencies [[print-foo "1.0.1"]]
24+
:test {:dependencies [[print-foo "1.0.1"]
25+
[incanter/incanter-core "1.5.7"]]
2526
:src-paths ["test/resources"]}
2627
:1.8 {:dependencies [[org.clojure/clojure "1.8.0"]]}
2728
:1.9 {:dependencies [[org.clojure/clojure "1.9.0-alpha14"]

src/refactor_nrepl/core.clj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,7 @@
236236
(= "/" fully-qualified-name)
237237
fully-qualified-name
238238

239-
(re-find #"\$" fully-qualified-name)
239+
(re-find #"\w\$\w" fully-qualified-name)
240240
(let [[outer & classes] (-> fully-qualified-name (.split "\\$"))
241241
outer (suffix outer)]
242242
(if (> (count classes) 1)

test/refactor_nrepl/ns/clean_ns_test.clj

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,8 @@
4141

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

44+
(def ns-with-incanter (clean-msg "test/resources/ns_with_incanter.clj"))
45+
4446
(deftest combines-requires
4547
(let [requires (core/get-ns-component (clean-ns ns2) :require)
4648
combined-requires (core/get-ns-component ns2-cleaned :require)]
@@ -199,3 +201,7 @@
199201
(let [cleaned (pprint-ns (clean-ns ns-with-multiple-shorthand-meta))]
200202
(is (re-find #"\^:automation" cleaned))
201203
(is (re-find #"\^:multiple" cleaned))))
204+
205+
(deftest does-not-remove-dollar-sign-if-valid-symbol
206+
(let [cleaned (pprint-ns (clean-ns ns-with-incanter))]
207+
(is (re-find #"\[\$\]" cleaned))))

0 commit comments

Comments
 (0)