Skip to content

Commit 480ce3b

Browse files
committed
Replace edn.el with parseedn.el
1 parent e24ba62 commit 480ce3b

File tree

2 files changed

+32
-31
lines changed

2 files changed

+32
-31
lines changed

clj-refactor.el

Lines changed: 22 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@
88
;; Benedek Fazekas <[email protected]>
99
;; Version: 2.5.0-snapshot
1010
;; Keywords: convenience, clojure, cider
11-
;; Package-Requires: ((emacs "25.1") (seq "2.19") (yasnippet "0.6.1") (paredit "24") (multiple-cursors "1.2.2") (clojure-mode "5.6.1") (cider "0.23.0") (edn "1.1.2") (inflections "2.3") (hydra "0.13.2"))
11+
12+
;; Package-Requires: ((emacs "25.1") (seq "2.19") (yasnippet "0.6.1") (paredit "24") (multiple-cursors "1.2.2") (clojure-mode "5.6.1") (cider "0.23.0") (parseedn "0.1") (inflections "2.3") (hydra "0.13.2"))
1213

1314
;; This program is free software; you can redistribute it and/or
1415
;; modify it under the terms of the GNU General Public License
@@ -1475,18 +1476,18 @@ Optionally adds :refer [REFER-NAMES] clause."
14751476
"Returns a list of the function names in STRING-WITH-DEFNS,
14761477
optionally including those that are declared private."
14771478
(cljr--with-string-content string-with-defns
1478-
(let ((count (paredit-count-sexps-forward))
1479-
(names '()))
1480-
(dotimes (_ count)
1481-
(paredit-forward-down)
1482-
(cljr--goto-toplevel)
1483-
(forward-char)
1484-
(if (and include-private (looking-at "defn-"))
1485-
(push (cljr--name-of-current-def) names)
1486-
(when (looking-at "defn ")
1487-
(push (cljr--name-of-current-def) names)))
1488-
(paredit-forward-up))
1489-
names)))
1479+
(let ((count (paredit-count-sexps-forward))
1480+
(names '()))
1481+
(dotimes (_ count)
1482+
(paredit-forward-down)
1483+
(cljr--goto-toplevel)
1484+
(forward-char)
1485+
(if (and include-private (looking-at "defn-"))
1486+
(push (cljr--name-of-current-def) names)
1487+
(when (looking-at "defn ")
1488+
(push (cljr--name-of-current-def) names)))
1489+
(paredit-forward-up))
1490+
names)))
14901491

14911492
(defun cljr--current-namespace ()
14921493
(save-excursion
@@ -1911,7 +1912,7 @@ FEATURE is either :clj or :cljs."
19111912
cljr--ensure-op-supported
19121913
cljr--create-msg
19131914
(cljr--call-middleware-sync "namespace-aliases")
1914-
edn-read))
1915+
parseedn-read-str))
19151916

19161917
(defun cljr--get-aliases-from-middleware ()
19171918
(when-let (aliases (cljr--call-middleware-for-namespace-aliases))
@@ -2505,7 +2506,7 @@ See: https://github.com/clojure-emacs/clj-refactor.el/wiki/cljr-promote-function
25052506
(unless (cljr--empty-buffer-p)
25062507
(goto-char (point-min))
25072508
(while (not (cljr--end-of-buffer-p))
2508-
(push (edn-read) occurrences))))
2509+
(push (parseedn-read-str) occurrences))))
25092510
occurrences))
25102511

25112512
(defun cljr--find-symbol (symbol ns callback)
@@ -2560,7 +2561,7 @@ root."
25602561
(when (= cjr--occurrence-count cljr--num-syms)
25612562
(cljr--finalise-find-symbol-buffer cljr--num-syms)))
25622563
(when-let (occurrence-data (nrepl-dict-get occurrence-resp "occurrence"))
2563-
(let* ((occurrence (edn-read occurrence-data))
2564+
(let* ((occurrence (parseedn-read-str occurrence-data))
25642565
(occurrence-id (format "%s%s"
25652566
(cljr--get-valid-filename occurrence)
25662567
(gethash :line-beg occurrence))))
@@ -2699,15 +2700,15 @@ Also adds the alias prefix to all occurrences of public symbols in the namespace
26992700
"used-ns" ns
27002701
"file" filename))
27012702
(occurrences (thread-last (cljr--call-middleware-sync request "used-publics")
2702-
(edn-read))))
2703+
(parseedn-read-str))))
27032704
(cljr--replace-refer-all-with-alias ns occurrences alias))))
27042705

27052706
(defun cljr--maybe-nses-in-bad-state (response)
27062707
(let ((asts-in-bad-state (seq-filter
27072708
(lambda (it)
27082709
(not (stringp (car (last it)))))
27092710
(thread-first (nrepl-dict-get response "ast-statuses")
2710-
edn-read
2711+
parseedn-read-str
27112712
(seq-partition 2)))))
27122713
(when (not (= 0 (length asts-in-bad-state)))
27132714
(user-error (concat "Some namespaces are in a bad state: "
@@ -2890,7 +2891,7 @@ Date. -> Date
28902891
(with-no-warnings (cider-current-session)))
28912892
(cljr--call-middleware-sync
28922893
"candidates")))
2893-
(edn-read candidates)))
2894+
(parseedn-read-str candidates)))
28942895

28952896
(defun cljr--get-error-value (response)
28962897
"Gets the error value from the middleware response.
@@ -3070,7 +3071,7 @@ See: https://github.com/clojure-emacs/clj-refactor.el/wiki/cljr-add-stubs"
30703071
(format "%s/%s" alias? (cljr--symbol-suffix interface))
30713072
interface)
30723073
(format "%s/%s" (cider-current-ns) interface)))
3073-
(functions (edn-read (cljr--call-middleware-sync
3074+
(functions (parseedn-read-str (cljr--call-middleware-sync
30743075
(cljr--create-msg "stubs-for-interface"
30753076
"interface" interface)
30763077
"functions"))))
@@ -3211,7 +3212,7 @@ See: https://github.com/clojure-emacs/clj-refactor.el/wiki/cljr-inline-symbol"
32113212
"name" symbol-name
32123213
"ignore-errors"
32133214
(when cljr-ignore-analyzer-errors "true")))
3214-
(response (edn-read (cljr--call-middleware-sync
3215+
(response (parseedn-read-str (cljr--call-middleware-sync
32153216
extract-definition-request "definition")))
32163217
(definition (gethash :definition response))
32173218
(occurrences (gethash :occurrences response)))

features/step-definitions/clj-refactor-steps.el

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@
155155

156156
(Given "^I call the add-stubs function directly with mock data for java.util.List from the middleware"
157157
(lambda ()
158-
(cljr--insert-function-stubs (edn-read "(
158+
(cljr--insert-function-stubs (parseedn-read-str "(
159159
{:parameter-list \"[^int arg]\", :name \"remove\"}
160160
{:parameter-list \"[^int arg0 ^Object arg1]\", :name \"add\"}
161161
{:parameter-list \"[^java.util.function.UnaryOperator arg]\", :name \"replaceAll\"}
@@ -187,11 +187,11 @@
187187

188188
(Given "^I call the add-stubs function directly with mock data for clojure.reflect from the middleware"
189189
(lambda ()
190-
(cljr--insert-function-stubs (edn-read "({:parameter-list \"[this]\", :name \"typename\"})"))))
190+
(cljr--insert-function-stubs (parseedn-read-str "({:parameter-list \"[this]\", :name \"typename\"})"))))
191191

192192
(Given "I call the cljr--inline-symbol function directly with mockdata to inline my-constant"
193193
(lambda ()
194-
(let ((response (edn-read "{:occurrences ({:match \"(println my-constant my-constant another-val)))\"
194+
(let ((response (parseedn-read-str "{:occurrences ({:match \"(println my-constant my-constant another-val)))\"
195195
:file \"core.clj\"
196196
:name \"refactor-nrepl.test/my-constant\"
197197
:col-end 26
@@ -217,7 +217,7 @@
217217

218218
(Given "I call the cljr--inline-symbol function directly with mockdata to inline another-val"
219219
(lambda ()
220-
(let ((response (edn-read "{:definition {:line-beg 4
220+
(let ((response (parseedn-read-str "{:definition {:line-beg 4
221221
:line-end 4
222222
:col-beg 9
223223
:col-end 21
@@ -237,7 +237,7 @@
237237

238238
(Given "I call the cljr--inline-symbol function directly with mockdata to inline some-val"
239239
(lambda ()
240-
(let ((response (edn-read "{:definition {:line-beg 5
240+
(let ((response (parseedn-read-str "{:definition {:line-beg 5
241241
:line-end 5
242242
:col-beg 9
243243
:col-end 17
@@ -251,7 +251,7 @@
251251

252252
(Given "I call the cljr--inline-symbol function directly with mockdata to inline my-inc"
253253
(lambda ()
254-
(let ((response (edn-read "{:definition {:definition \"(fn [n]\\n (+ 1 n))\"
254+
(let ((response (parseedn-read-str "{:definition {:definition \"(fn [n]\\n (+ 1 n))\"
255255
:line-beg 1
256256
:line-end 2
257257
:col-beg 1
@@ -273,11 +273,11 @@
273273
:file \"core.clj\"
274274
:match \"(map my-inc (range 10))\"})}")))
275275
(cljr--inline-symbol (gethash :definition response)
276-
(gethash :occurrences response)))))
276+
(gethash :occurrences response)))))
277277

278278
(Given "I call the cljr--inline-symbol function directly with mockdata to inline trim-lower"
279279
(lambda ()
280-
(let ((response (edn-read "{:definition {:definition \"(comp str/lower-case str/trim)\"
280+
(let ((response (parseedn-read-str "{:definition {:definition \"(comp str/lower-case str/trim)\"
281281
:line-beg 1
282282
:line-end 1
283283
:col-beg 2
@@ -411,7 +411,7 @@
411411
(Given "The cache of namespace aliases is populated"
412412
(lambda ()
413413
(defun cljr--call-middleware-for-namespace-aliases ()
414-
(edn-read "{:clj {t (clojure.test)
414+
(parseedn-read-str "{:clj {t (clojure.test)
415415
set (clojure.set)
416416
pprint (clojure.pprint)
417417
util (refactor-nrepl.util clojure.tools.analyzer.jvm.utils)
@@ -460,7 +460,7 @@ pprint (cljs.pprint)}}"))))
460460
(lambda (ns-name)
461461
(cljr--replace-refer-all-with-alias
462462
ns-name
463-
(edn-read
463+
(parseedn-read-str
464464
"({:line-beg 5 :line-end 5 :col-beg 13 :col-end 30 :file\"one.clj\" :name \"foo\"} {:line-beg 8 :line-end 8 :col-beg 15 :col-end 28 :file \"one.clj\" :name \"star*\"})")
465465
"two")))
466466

0 commit comments

Comments
 (0)