@@ -1015,11 +1015,12 @@ Returns a list of the form ((session1 host1) (session2 host2) ...)."
1015
1015
sessions
1016
1016
:initial-value '()))
1017
1017
1018
- (defun cider-repls (&optional type ensure )
1018
+ (defun cider-repls (&optional type ensure ops-to-support )
1019
1019
" Return cider REPLs of TYPE from the current session.
1020
1020
If TYPE is nil or multi, return all REPLs. If TYPE is a list of types,
1021
1021
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."
1023
1024
(let ((type (cond
1024
1025
((listp type)
1025
1026
(mapcar #'cider-maybe-intern type))
@@ -1045,7 +1046,10 @@ throw an error if no linked session exists."
1045
1046
(or (seq-filter (lambda (b )
1046
1047
(unless
1047
1048
(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))))
1049
1053
repls)
1050
1054
(when ensure
1051
1055
(cider--no-repls-user-error type)))))
@@ -1082,16 +1086,8 @@ session."
1082
1086
(ensure (cl-case which-key
1083
1087
(:auto nil )
1084
1088
(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))))
1095
1091
1096
1092
; ; REPLs double as connections in CIDER, so it's useful to be able to refer to
1097
1093
; ; them as connections in certain contexts.
0 commit comments