Function: nrepl--direct-connect

nrepl--direct-connect is a byte-compiled function defined in nrepl-client.el.

Signature

(nrepl--direct-connect HOST PORT &optional NO-ERROR)

Documentation

If HOST and PORT are given, try to open-network-stream.

If NO-ERROR is non-nil, show messages instead of throwing an error.

Source Code

;; Defined in ~/.emacs.d/elpa/cider-20260414.1619/nrepl-client.el
(defun nrepl--direct-connect (host port &optional no-error)
  "If HOST and PORT are given, try to `open-network-stream'.
If NO-ERROR is non-nil, show messages instead of throwing an error."
  (if (not (and host port))
      (unless no-error
        (unless host
          (error "[nREPL] Host not provided"))
        (unless port
          (error "[nREPL] Port not provided")))
    (message "[nREPL] Establishing direct connection to %s:%s ..." host port)
    (condition-case nil
        (prog1 (list :proc (open-network-stream "nrepl-connection" nil host port)
                     :host host :port port)
          (message "[nREPL] Direct connection to %s:%s established" host port))
      (error (let ((msg (format "[nREPL] Direct connection to %s:%s failed" host port)))
               (if no-error
                   (message msg)
                 (error msg))
               nil)))))