File tree Expand file tree Collapse file tree 3 files changed +28
-3
lines changed Expand file tree Collapse file tree 3 files changed +28
-3
lines changed Original file line number Diff line number Diff line change @@ -29,6 +29,8 @@ visually distinctive from `cider-repl-output-face` (used for STDOUT output).
29
29
30
30
### Bugs fixed
31
31
32
+ * [ #501 ] ( https://github.com/clojure-emacs/cider/issues/501 ) Fix
33
+ nil appearing in nrepl-server buffer name when no project directory.
32
34
* [ #493 ] ( https://github.com/clojure-emacs/cider/issues/493 ) Fix rotate connection to handle no
33
35
nREPL connection.
34
36
* [ #468 ] ( https://github.com/clojure-emacs/cider/issues/468 ) Fix
Original file line number Diff line number Diff line change @@ -102,6 +102,13 @@ buffer will be hidden.")
102
102
" Apply a prefix to BUFFER-NAME that will hide the buffer."
103
103
(concat (if nrepl-hide-special-buffers " " " " ) buffer-name))
104
104
105
+ (defun nrepl-format-buffer-name-template (buffer-name-template designation )
106
+ " Apply the DESIGNATION to the corresponding BUFFER-NAME-TEMPLATE."
107
+ (format buffer-name-template
108
+ (if (> (length designation) 0 )
109
+ (concat nrepl-buffer-name-separator designation)
110
+ " " )))
111
+
105
112
(defun nrepl-buffer-name (buffer-name-template )
106
113
" Generate a buffer name using BUFFER-NAME-TEMPLATE.
107
114
@@ -111,10 +118,9 @@ connection port if `nrepl-buffer-name-show-port' is true."
111
118
(generate-new-buffer-name
112
119
(let ((project-name (nrepl--project-name nrepl-project-dir))
113
120
(nrepl-proj-port (cadr nrepl-endpoint)))
114
- (format
121
+ (nrepl- format-buffer-name-template
115
122
buffer-name-template
116
- (concat (format " %s%s " nrepl-buffer-name-separator
117
- (if project-name project-name (car nrepl-endpoint)))
123
+ (concat (if project-name project-name (car nrepl-endpoint))
118
124
(if (and nrepl-proj-port nrepl-buffer-name-show-port)
119
125
(format " :%s " nrepl-proj-port) " " ))))))
120
126
Original file line number Diff line number Diff line change 212
212
(should (equal b3 (current-buffer ))))))
213
213
(kill-buffer " *nrepl-connections*" ))))))))
214
214
215
+ (ert-deftest test-nrepl-format-buffer-name-template ()
216
+ (should (equal " *template designation-foo*"
217
+ (nrepl-format-buffer-name-template " *template%s*" " designation-foo" ))))
218
+
219
+ (ert-deftest test-nrepl-format-buffer-name-template-use-separator ()
220
+ (let ((nrepl-buffer-name-separator " _" ))
221
+ (should (equal " *template_designation-foo*"
222
+ (nrepl-format-buffer-name-template " *template%s*" " designation-foo" )))))
223
+
224
+ (ert-deftest test-nrepl-format-buffer-name-template-handle-nil-designation ()
225
+ (should (equal " *template*"
226
+ (nrepl-format-buffer-name-template " *template%s*" nil ))))
227
+
228
+ (ert-deftest test-nrepl-format-buffer-name-template-handle-empty-designation ()
229
+ (should (equal " *template*"
230
+ (nrepl-format-buffer-name-template " *template%s*" " " ))))
231
+
215
232
(ert-deftest test-nrepl-buffer-name ()
216
233
(with-temp-buffer
217
234
(setq-local nrepl-endpoint '(" localhost" 1 ))
You can’t perform that action at this time.
0 commit comments