Skip to content

Commit 9f9a89a

Browse files
committed
cider--completing-read-port: Default to 7888
Whilst 7888 isn't the official port (see nrepl/nrepl#6 discussion), it's frequently used in practice. Set that as the default value in the minibuffer if we couldn't infer a port. Most nREPL implementations do create a `.nrepl-port` file but it's nice to have 7888 suggested to save a few keystrokes.
1 parent 61a7b7b commit 9f9a89a

2 files changed

Lines changed: 6 additions & 1 deletion

File tree

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
- Bound `nrepl-completed-requests` with a FIFO cap (`nrepl-completed-requests-max-size`, default 1000). The completed-request handler table previously grew unbounded for the lifetime of a connection; long-running sessions accumulated thousands of stale handler closures.
2828
- [#3909](https://github.com/clojure-emacs/cider/issues/3909): `cider--sesman-friendly-session-p` is more robust at attaching buffers to existing sessions. The classpath and namespace caches are now populated eagerly at connection time instead of lazily on first sesman call (previously a nil/empty result was indistinguishable from "not cached" and was re-fetched on every check). The matcher is now a pure path comparison and never blocks on the REPL. Beyond the caching fix, it also falls back to the connection's `nrepl-project-dir` when classpath matching fails, uses `file-in-directory-p` for classpath-root boundary checks (avoiding spurious prefix matches like `/foo/bar` against `/foo/barber/...`), and short-circuits to the chosen session when `cider-default-session` is set.
2929
- `nrepl-bencode` no longer crashes when handed a non-string scalar (symbol, float, etc.). The documented fallback ("everything else is encoded as string") used `string-bytes` directly, which errors on non-string input; values are now coerced via `format' before measuring byte length.
30+
- `cider--completing-read-port` now defaults to `7888` when no running nREPL port can be inferred.
3031

3132
### Changes
3233

lisp/cider-endpoint.el

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,9 @@ Sub-match 1 must be the project path.")
7070
(defvar cider-host-history nil
7171
"Completion history for connection hosts.")
7272

73+
(defconst cider-default-nrepl-port "7888"
74+
"Use this port number when we couldn't infer a port.
75+
See also https://github.com/nrepl/nREPL/issues/6.")
7376

7477
;;; Endpoint selection
7578

@@ -158,7 +161,8 @@ of remote SSH hosts."
158161
"Interactively select port for HOST from PORTS."
159162
(let* ((ports (cider-join-into-alist ports))
160163
(sel-port (completing-read (format "Port for %s: " host) ports
161-
nil nil nil nil (caar ports)))
164+
nil nil nil nil (or (caar ports)
165+
cider-default-nrepl-port)))
162166
(port (or (cdr (assoc sel-port ports)) sel-port))
163167
(port (if (listp port) (cadr port) port)))
164168
(if (stringp port) (string-to-number port) port)))

0 commit comments

Comments
 (0)