Function: cider-map-repls

cider-map-repls is a byte-compiled function defined in cider-connection.el.

Signature

(cider-map-repls WHICH FUNCTION)

Documentation

Call FUNCTION once for each appropriate REPL as indicated by WHICH.

The function is called with one argument, the REPL buffer. The appropriate connections are found by inspecting the current buffer. WHICH is either one of the following keywords or a list starting with one of them followed by names of operations that the REPL is expected to support:
 :auto - Act on the connections whose type matches the current buffer. In
     cljc files, mapping happens over both types of REPLs.
 :clj (:cljs) - Map over clj (cljs)) REPLs only.
 :clj-strict (:cljs-strict) - Map over clj (cljs) REPLs but signal a
      user-error in clojurescript-mode (clojure-mode). Use this for
      commands only supported in Clojure (ClojureScript).
Error is signaled if no REPL buffers of specified type exist in current session.

Aliases

cider-map-connections

Source Code

;; Defined in ~/.emacs.d/elpa/cider-20260414.1619/cider-connection.el
(defun cider-map-repls (which function)
  "Call FUNCTION once for each appropriate REPL as indicated by WHICH.
The function is called with one argument, the REPL buffer.  The appropriate
connections are found by inspecting the current buffer.  WHICH is either one of
the following keywords or a list starting with one of them followed by names of
operations that the REPL is expected to support:
 :auto - Act on the connections whose type matches the current buffer.  In
     `cljc' files, mapping happens over both types of REPLs.
 :clj (:cljs) - Map over clj (cljs)) REPLs only.
 :clj-strict (:cljs-strict) - Map over clj (cljs) REPLs but signal a
      `user-error' in `clojurescript-mode' (`clojure-mode').  Use this for
      commands only supported in Clojure (ClojureScript).
Error is signaled if no REPL buffers of specified type exist in current
session."
  (declare (indent 1))
  (let ((cur-type (cider-repl-type-for-buffer))
        (which-key (or (car-safe which) which))
        (required-ops (cdr-safe which)))
    (pcase which-key
      (:clj-strict (when (eq cur-type 'cljs)
                     (user-error "Clojure-only operation requested in a ClojureScript buffer")))
      (:cljs-strict (when (eq cur-type 'clj)
                      (user-error "ClojureScript-only operation requested in a Clojure buffer"))))
    (let* ((type (pcase which-key
                   ((or :clj :clj-strict) 'clj)
                   ((or :cljs :cljs-strict) 'cljs)
                   (:auto (if (eq cur-type 'multi)
                              '(clj cljs)
                            cur-type))))
           (ensure (pcase which-key
                     (:auto nil)
                     (_ 'ensure)))
           (repls (cider-repls type ensure required-ops)))
      (mapcar function repls))))