Function: cider--host-history-candidate

cider--host-history-candidate is a byte-compiled function defined in cider-endpoint.el.

Signature

(cider--host-history-candidate ENTRY)

Documentation

Return a (HOST PORT) or (HOST) candidate from the history ENTRY.

ENTRY is a "host:port" string from cider-host-history. The port makes reconnecting to the same server a single RET - but it comes from a previous session, so when the host is local and nothing is listening on the port anymore, offer just the host and let port inference take over instead of defaulting to a stale endpoint.

Source Code

;; Defined in ~/.emacs.d/elpa/cider-20260822.1520/cider-endpoint.el
(defun cider--host-history-candidate (entry)
  "Return a (HOST PORT) or (HOST) candidate from the history ENTRY.
ENTRY is a \"host:port\" string from `cider-host-history'.  The port
makes reconnecting to the same server a single RET - but it comes from
a previous session, so when the host is local and nothing is listening
on the port anymore, offer just the host and let port inference take
over instead of defaulting to a stale endpoint."
  (let* ((parts (split-string entry ":"))
         (host (car parts))
         (port (cadr parts))
         (port-number (and port (nrepl--port-string-to-number port))))
    (cond ((null port-number) (list host))
          ((and (nrepl-local-host-p host)
                (not (nrepl--port-alive-p port-number)))
           (list host))
          (t (list host port)))))