@@ -182,6 +182,7 @@ To be used for tooling calls (i.e. completion, eldoc, etc)")
182
182
; ;; nREPL Buffer Names
183
183
184
184
(defconst nrepl-message-buffer-name-template " *nrepl-messages %s*" )
185
+ (defconst nrepl-error-buffer-name " *nrepl-error*" )
185
186
(defconst nrepl-repl-buffer-name-template " *cider-repl%s*" )
186
187
(defconst nrepl-connection-buffer-name-template " *nrepl-connection%s*" )
187
188
(defconst nrepl-server-buffer-name-template " *nrepl-server%s*" )
@@ -493,11 +494,11 @@ object is a root list or dict."
493
494
; ; else, throw a quiet error
494
495
(t
495
496
(message " Invalid bencode message detected. See %s buffer. "
496
- nrepl-message -buffer-name-template )
497
- (nrepl-log-message
497
+ nrepl-error -buffer-name)
498
+ (nrepl-log-error
498
499
(format " Decoder error at position %d (`%s' ): "
499
500
(point ) (buffer-substring (point ) (min (+ (point ) 10 ) (point-max )))))
500
- (nrepl-log-message (buffer-string ))
501
+ (nrepl-log-error (buffer-string ))
501
502
(ding )
502
503
; ; Ensure loop break and clean queues' states in nrepl-bdecode:
503
504
(goto-char (point-max ))
@@ -1272,6 +1273,26 @@ The default buffer name is *nrepl-messages session*."
1272
1273
(nrepl-messages-mode)
1273
1274
buffer)))))
1274
1275
1276
+ (defun nrepl-error-buffer ()
1277
+ " Return or create the buffer.
1278
+ The default buffer name is *nrepl-error*."
1279
+ (or (get-buffer nrepl-error-buffer-name)
1280
+ (let ((buffer (get-buffer-create nrepl-error-buffer-name)))
1281
+ (with-current-buffer buffer
1282
+ (buffer-disable-undo )
1283
+ (fundamental-mode )
1284
+ buffer))))
1285
+
1286
+ (defun nrepl-log-error (msg )
1287
+ " Log the given MSG to the buffer given by `nrepl-error-buffer' ."
1288
+ (with-current-buffer (nrepl-error-buffer)
1289
+ (setq buffer-read-only nil )
1290
+ (goto-char (point-max ))
1291
+ (insert msg)
1292
+ (when-let ((win (get-buffer-window )))
1293
+ (set-window-point win (point-max )))
1294
+ (setq buffer-read-only t )))
1295
+
1275
1296
(defun nrepl-create-client-buffer-default (endpoint )
1276
1297
" Create an nREPL client process buffer.
1277
1298
ENDPOINT is a plist returned by `nrepl-connect' ."
0 commit comments