Skip to content

Commit a443a9a

Browse files
committed
Add nrepl-show-messages to pop up the nREPL messages buffer
Previously the only way to find the messages buffer was to remember its template-generated name and dig it out of the buffer list. The new command finds live nrepl-messages-mode buffers; with one connection it pops it directly, with several it prompts. Bundles a CHANGELOG entry for all three nREPL log UX changes on this branch.
1 parent 9e4e7a0 commit a443a9a

2 files changed

Lines changed: 20 additions & 0 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
- New `cider-repl-history-doctor` command: walks `cider-repl-input-history` looking for entries whose parens don't balance under Clojure syntax, shows each in a side buffer, and asks whether to delete it. When done, rewrites `cider-repl-history-file` if one is configured. Useful for cleaning up history after a typo got committed that breaks `cider-repl-history` rendering (see [#3915](https://github.com/clojure-emacs/cider/issues/3915)).
1313
- Recognize [let-go](https://github.com/nooga/let-go) (a Clojure dialect implemented in Go) as a known nREPL runtime. `cider-runtime` returns `let-go` for these connections and the connection info line shows the runtime version, e.g. `CLJ project@localhost:2137 (let-go 1.0)`.
1414
- Decouple the nREPL transport layer from CIDER's UI layer (closes [#1099](https://github.com/clojure-emacs/cider/issues/1099)). `nrepl-make-eval-handler` is now CIDER-agnostic: it no longer references `nrepl-namespace-handler-function`, `nrepl-err-handler-function`, `nrepl-need-input-handler-function`, or any hardcoded UI strings. New `:on-ns` and `:on-status` keyword slots let any consumer wire up their own namespace tracking and status handling. The editor-level `cider-make-eval-handler` wraps it with CIDER's UI behavior (ns tracking, default error handler, need-input prompt, "Evaluation interrupted." / "Namespace not found." messages); in-tree callers all use it.
15+
- New nREPL message log commands: `nrepl-show-messages` pops up the messages buffer (prompting when there are multiple connections), and `c` in `nrepl-messages-mode` runs the new `nrepl-clear-messages` to wipe the buffer. Auto-follow on new entries now leaves windows alone if you've scrolled back to read history; only windows already at end-of-buffer get scrolled to the latest message.
1516

1617
### Bugs fixed
1718

lisp/nrepl-client.el

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1307,6 +1307,25 @@ This in effect enables or disables the logging of nREPL messages."
13071307
(let ((inhibit-read-only t))
13081308
(erase-buffer)))
13091309

1310+
(defun nrepl-show-messages ()
1311+
"Pop up an nREPL messages buffer.
1312+
With more than one active connection, prompt for which one to show.
1313+
If `nrepl-log-messages' is nil no buffer exists yet, so signal an
1314+
error pointing at `nrepl-toggle-message-logging'."
1315+
(interactive)
1316+
(let ((buffers (seq-filter (lambda (b)
1317+
(with-current-buffer b
1318+
(derived-mode-p 'nrepl-messages-mode)))
1319+
(buffer-list))))
1320+
(pcase (length buffers)
1321+
(0 (user-error "No nREPL messages buffer exists; enable logging with `nrepl-toggle-message-logging'"))
1322+
(1 (pop-to-buffer (car buffers)))
1323+
(_ (pop-to-buffer
1324+
(get-buffer
1325+
(completing-read "nREPL messages buffer: "
1326+
(mapcar #'buffer-name buffers)
1327+
nil t)))))))
1328+
13101329
(defcustom nrepl-message-colors
13111330
'("red" "brown" "coral" "orange" "green" "deep sky blue" "blue" "dark violet")
13121331
"Colors used in the messages buffer."

0 commit comments

Comments
 (0)