summaryrefslogtreecommitdiff
path: root/nrepl-client.el
diff options
context:
space:
mode:
authorArtur Malabarba <bruce.connor.am@gmail.com>2015-11-29 15:36:38 +0000
committerArtur Malabarba <bruce.connor.am@gmail.com>2015-11-29 15:45:50 +0000
commit1582f2f2ada70335b54b171b3487a972330c7241 (patch)
tree5cbe01daf26779d397a5b39e0c2747f277eb8bc5 /nrepl-client.el
parent031e8895a7486032d8f2fb79a062fee681261209 (diff)
[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.
Diffstat (limited to 'nrepl-client.el')
-rw-r--r--nrepl-client.el8
1 files changed, 6 insertions, 2 deletions
diff --git a/nrepl-client.el b/nrepl-client.el
index 93161ae8..a7f5bcd9 100644
--- a/nrepl-client.el
+++ b/nrepl-client.el
@@ -1266,8 +1266,12 @@ Set this to nil to prevent truncation."
(defun nrepl-messages-buffer (msg)
"Return or create the buffer for MSG.
The default buffer name is *nrepl-messages session*."
- (let* ((msg-session (nrepl-dict-get msg "session"))
- (msg-buffer-name (format nrepl-message-buffer-name-template msg-session)))
+ ;; Log `new-session' replies to the "orphan" buffer, because that's probably
+ ;; where we logged the request it's replying to.
+ (let* ((msg-session (or (unless (nrepl-dict-get msg "new-session")
+ (nrepl-dict-get msg "session"))
+ "00000000-0000-0000-0000-000000000000"))
+ (msg-buffer-name (format nrepl-message-buffer-name-template msg-session)))
(or (get-buffer msg-buffer-name)
(let ((buffer (get-buffer-create msg-buffer-name)))
(with-current-buffer buffer