Skip to content

Commit 837635a

Browse files
committed
Merge pull request #786 from vitoshka/master
[fix #772] and fix broken `cider-eval-and-get-value`
2 parents 123e1b5 + be86fcf commit 837635a

File tree

5 files changed

+13
-18
lines changed

5 files changed

+13
-18
lines changed

cider-browse-ns.el

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@
9696
(interactive (list (completing-read "Browse namespace: " (cider--all-ns))))
9797
(with-current-buffer (cider-popup-buffer cider-browse-ns-buffer t)
9898
(let* ((form "(sort (map name (keys (ns-publics (quote %s)))))")
99-
(vars (cider-eval-and-get-value (format form namespace))))
99+
(vars (cider-sync-eval-and-parse (format form namespace))))
100100
(cider-browse-ns-list (current-buffer)
101101
namespace
102102
(mapcar (lambda (var)
@@ -110,7 +110,7 @@
110110
"List all loaded namespaces in BUFFER."
111111
(interactive)
112112
(with-current-buffer (cider-popup-buffer cider-browse-ns-buffer t)
113-
(let ((names (cider-eval-and-get-value
113+
(let ((names (cider-sync-eval-and-parse
114114
"(->> (all-ns)
115115
(map ns-name)
116116
(map name)
@@ -140,6 +140,8 @@
140140
(cider-browse-ns-operate-on-point))
141141

142142

143+
(define-obsolete-variable-alias 'cider-eval-and-get-value 'cider-sync-eval-and-parse "0.8.0")
144+
143145
(provide 'cider-browse-ns)
144146

145147
;;; cider-browse-ns.el ends here

cider-client.el

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -116,25 +116,18 @@ NS specifies the namespace in which to evaluate the request."
116116
NS & SESSION specify the evaluation context."
117117
(nrepl-sync-request:eval input ns session))
118118

119-
(defun cider-eval-and-get-value (input &optional ns session)
119+
(defun cider-sync-eval-and-parse (input &optional ns session)
120120
"Send the INPUT to the nREPL server synchronously and return the value.
121-
NS & SESSION specify the evaluation context."
122-
(cider-get-value (cider-eval-sync input ns session)))
121+
NS & SESSION specify the evaluation context. The output must be a readable
122+
Emacs list or a vector of other lists and vectors as `read' is used to
123+
convert the output into an Emacs object."
124+
(read (plist-get (cider-eval-sync input ns session) :value)))
123125

124126
(defun cider-tooling-eval-sync (input &optional ns)
125127
"Send the INPUT to the nREPL server using a tooling session synchronously.
126128
NS specifies the namespace in which to evaluate the request."
127129
(cider-eval-sync input ns (nrepl-current-tooling-session)))
128130

129-
(defun cider-get-raw-value (eval-result)
130-
"Get the raw value (as string) from EVAL-RESULT."
131-
(plist-get eval-result :value))
132-
133-
(defun cider-get-value (eval-result)
134-
"Get the value from EVAL-RESULT."
135-
(with-output-to-string
136-
(message "%s" (cider-get-raw-value eval-result))))
137-
138131
(defun cider-send-op (op attributes handler)
139132
"Send the specified OP with ATTRIBUTES and response HANDLER."
140133
(nrepl-send-request (append

cider-interaction.el

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1329,7 +1329,7 @@ If invoked with a PREFIX argument, print the result in the current buffer."
13291329
(interactive)
13301330
(let ((last-sexp (cider-last-sexp)))
13311331
;; we have to be sure the evaluation won't result in an error
1332-
(cider-eval-and-get-value last-sexp)
1332+
(cider-eval-sync last-sexp)
13331333
;; seems like the sexp is valid, so we can safely kill it
13341334
(backward-kill-sexp)
13351335
(cider-interactive-eval-print last-sexp)))
@@ -1400,7 +1400,7 @@ If invoked with a prefix ARG eval the expression after inserting it."
14001400
(defun cider-ping ()
14011401
"Check that communication with the server works."
14021402
(interactive)
1403-
(message "%s" (cider-eval-and-get-value "\"PONG\"")))
1403+
(message "%s" (cider-sync-eval-and-parse "\"PONG\"")))
14041404

14051405
(defun clojure-enable-cider ()
14061406
"Turn on CIDER mode (see command `cider-mode').

cider-repl.el

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -656,7 +656,7 @@ text property `cider-old-input'."
656656

657657
(defun cider--all-ns ()
658658
"Get a list of the available namespaces."
659-
(cider-eval-and-get-value
659+
(cider-sync-eval-and-parse
660660
"(clojure.core/map clojure.core/str (clojure.core/all-ns))"))
661661

662662
(defun cider-repl-set-ns (ns)

test/cider-tests--no-auto.el

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ from the latter. Remaining content is compared for string equality."
6969

7070
(defun cider-test-all-docs ()
7171
"Verify docs for all special forms and every public var in `clojure/core'."
72-
(let ((syms (cider-eval-and-get-value
72+
(let ((syms (cider-sync-eval-and-parse
7373
"(->> (merge @#'clojure.repl/special-doc-map
7474
(->> (ns-map 'clojure.core)
7575
(filter (every-pred

0 commit comments

Comments
 (0)