Skip to content

Commit b5608dd

Browse files
committed
3834 Extend cider-repls to filter out REPLs that do not support needed ops, use the new format also in cider-toggle-trace-ns
1 parent f65ea20 commit b5608dd

File tree

2 files changed

+10
-15
lines changed

2 files changed

+10
-15
lines changed

cider-connection.el

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1015,11 +1015,12 @@ Returns a list of the form ((session1 host1) (session2 host2) ...)."
10151015
sessions
10161016
:initial-value '()))
10171017

1018-
(defun cider-repls (&optional type ensure)
1018+
(defun cider-repls (&optional type ensure ops-to-support)
10191019
"Return cider REPLs of TYPE from the current session.
10201020
If TYPE is nil or multi, return all REPLs. If TYPE is a list of types,
10211021
return only REPLs of type contained in the list. If ENSURE is non-nil,
1022-
throw an error if no linked session exists."
1022+
throw an error if no linked session exists. If OPS-TO-SUPPORT is non-nil,
1023+
filters out all the REPLs that do not support the designated ops."
10231024
(let ((type (cond
10241025
((listp type)
10251026
(mapcar #'cider-maybe-intern type))
@@ -1045,7 +1046,10 @@ throw an error if no linked session exists."
10451046
(or (seq-filter (lambda (b)
10461047
(unless
10471048
(cider-cljs-pending-p b)
1048-
(cider--match-repl-type type b)))
1049+
(and (cider--match-repl-type type b)
1050+
(seq-every-p (lambda (op)
1051+
(nrepl-op-supported-p op b))
1052+
ops-to-support))))
10491053
repls)
10501054
(when ensure
10511055
(cider--no-repls-user-error type)))))
@@ -1082,16 +1086,8 @@ session."
10821086
(ensure (cl-case which-key
10831087
(:auto nil)
10841088
(t 'ensure)))
1085-
(repls (cider-repls type ensure)))
1086-
(mapcar (lambda (repl)
1087-
(mapc (lambda (op)
1088-
(unless (nrepl-op-supported-p op repl)
1089-
(user-error "`%s' requires the nREPL op \"%s\" (provided by cider-nrepl)"
1090-
this-command op)))
1091-
ops-to-support)
1092-
(funcall function repl))
1093-
repls))))
1094-
1089+
(repls (cider-repls type ensure ops-to-support)))
1090+
(mapcar function repls))))
10951091

10961092
;; REPLs double as connections in CIDER, so it's useful to be able to refer to
10971093
;; them as connections in certain contexts.

cider-tracing.el

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,10 +72,9 @@ opposite of what that option dictates."
7272
"Toggle ns tracing.
7373
Defaults to the current ns. With prefix arg QUERY, prompts for a ns."
7474
(interactive "P")
75-
(cider-map-repls :clj-strict
75+
(cider-map-repls '(:clj-strict "toggle-trace-ns")
7676
(lambda (conn)
7777
(with-current-buffer conn
78-
(cider-ensure-op-supported "toggle-trace-ns")
7978
(let ((ns (if query
8079
(completing-read "Toggle trace for ns: "
8180
(cider-sync-request:ns-list))

0 commit comments

Comments
 (0)