Skip to content

Commit fa02e3b

Browse files
committed
Merge pull request #531 from gtrak/master
Allow dicts in value response for clojure-emacs/cider-nrepl#27
2 parents 1672e80 + 40482ef commit fa02e3b

File tree

2 files changed

+21
-12
lines changed

2 files changed

+21
-12
lines changed

cider-client.el

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -166,16 +166,24 @@ loaded."
166166
(buffer-local-value 'nrepl-repl-buffer
167167
(get-buffer (nrepl-current-connection-buffer)))))
168168

169+
(defun cider--dict-to-alist (val)
170+
"Transforms a nREPL bdecoded dict VAL into an alist. Simply returns
171+
it if it's not a dict."
172+
(if (and (listp val)
173+
(eq (car val) 'dict))
174+
(-map '-cons-to-list (cdr val))
175+
val))
176+
169177
(defun cider-var-info (var)
170-
"Return VAR's info as an alist."
178+
"Return VAR's info as an alist with list cdrs."
171179
(when var
172180
(let ((val (plist-get (nrepl-send-request-sync
173181
(list "op" "info"
174182
"session" (nrepl-current-session)
175183
"ns" (cider-current-ns)
176184
"symbol" var))
177185
:value)))
178-
(-partition 2 val))))
186+
(cider--dict-to-alist val))))
179187

180188
(defun cider-get-var-attr (var attr)
181189
"Return VAR's ATTR."

test/cider-tests.el

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -66,16 +66,17 @@
6666
(ert-deftest test-cider-var-info ()
6767
(noflet ((nrepl-send-request-sync (list)
6868
`(:value
69-
("arglists" "([] [x] [x & ys])"
70-
"ns" "clojure.core"
71-
"name" "str"
72-
"column" 1
73-
"added" "1.0"
74-
"static" "true"
75-
"doc" "stub"
76-
"line" 504
77-
"file" "jar:file:/clojure-1.5.1.jar!/clojure/core.clj"
78-
"tag" "class java.lang.String")
69+
(dict
70+
("arglists" . "([] [x] [x & ys])")
71+
("ns" . "clojure.core")
72+
("name" . "str")
73+
("column" . 1)
74+
("added" . "1.0")
75+
("static" . "true")
76+
("doc" . "stub")
77+
("line" . 504)
78+
("file" . "jar:file:/clojure-1.5.1.jar!/clojure/core.clj")
79+
("tag" . "class java.lang.String"))
7980
:done t))
8081
(nrepl-current-session () nil)
8182
(cider-current-ns () "user"))

0 commit comments

Comments
 (0)