Skip to content

Commit 1582f2f

Browse files
committed
[Fix #1412] Improve the nrepl-messages redirection
Never use `nil` on the name of the messages buffer. Replies to clone requests go to the same buffer as the original request.
1 parent 031e889 commit 1582f2f

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

nrepl-client.el

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1266,8 +1266,12 @@ Set this to nil to prevent truncation."
12661266
(defun nrepl-messages-buffer (msg)
12671267
"Return or create the buffer for MSG.
12681268
The default buffer name is *nrepl-messages session*."
1269-
(let* ((msg-session (nrepl-dict-get msg "session"))
1270-
(msg-buffer-name (format nrepl-message-buffer-name-template msg-session)))
1269+
;; Log `new-session' replies to the "orphan" buffer, because that's probably
1270+
;; where we logged the request it's replying to.
1271+
(let* ((msg-session (or (unless (nrepl-dict-get msg "new-session")
1272+
(nrepl-dict-get msg "session"))
1273+
"00000000-0000-0000-0000-000000000000"))
1274+
(msg-buffer-name (format nrepl-message-buffer-name-template msg-session)))
12711275
(or (get-buffer msg-buffer-name)
12721276
(let ((buffer (get-buffer-create msg-buffer-name)))
12731277
(with-current-buffer buffer

0 commit comments

Comments
 (0)