Skip to content

Commit 93c2942

Browse files
committed
[Fix #2244] Display the REPL name in the modeline
I couldn't find a better way to do it, but this seems to work well. I was on the fence about Clojure-REPL vs REPL[clj], but opted to go with the shorter variant (mostly becausee ClojureScript-REPL is quite long). We can easily name this configurable.
1 parent 432078e commit 93c2942

File tree

3 files changed

+9
-5
lines changed

3 files changed

+9
-5
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
* [#2235](https://github.com/clojure-emacs/cider/pull/2235): Make the REPL ignore blank input rather than evaluating.
1919
* [#2241](https://github.com/clojure-emacs/cider/pull/2241): Make `cider-test-ediff` diff eval'ed values.
2020
* Add support for shadow-cljs to `cider-jack-in`.
21+
* [#2244](https://github.com/clojure-emacs/cider/issues/2244): Display the REPL type in the modeline.
2122

2223
### Bugs Fixed
2324

cider-repl.el

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ via `cider-current-connection'.")
225225
(when (member "state" (nrepl-dict-get response "status"))
226226
(nrepl-dbind-response response (repl-type changed-namespaces)
227227
(when repl-type
228-
(setq cider-repl-type repl-type))
228+
(cider-repl-set-type repl-type))
229229
(unless (nrepl-dict-empty-p changed-namespaces)
230230
(setq cider-repl-ns-cache (nrepl-dict-merge cider-repl-ns-cache changed-namespaces))
231231
(dolist (b (buffer-list))
@@ -261,7 +261,7 @@ ENDPOINT is a plist as returned by `nrepl-connect'."
261261
(with-current-buffer (get-buffer-create buff-name)
262262
(unless (derived-mode-p 'cider-repl-mode)
263263
(cider-repl-mode)
264-
(setq cider-repl-type "clj"))
264+
(cider-repl-set-type "clj"))
265265
(setq nrepl-err-handler #'cider-default-err-handler)
266266
(cider-repl-reset-markers)
267267
(add-hook 'nrepl-response-handler-functions #'cider-repl--state-handler nil 'local)
@@ -1065,7 +1065,10 @@ namespace to switch to."
10651065
(format "Set REPL type (currently `%s') to: "
10661066
cider-repl-type)
10671067
'("clj" "cljs")))))
1068-
(setq cider-repl-type type)))
1068+
(setq cider-repl-type type)
1069+
(if (equal type "cljs")
1070+
(setq mode-name "REPL[cljs]")
1071+
(setq mode-name "REPL[clj]"))))
10691072

10701073

10711074
;;; Location References

cider.el

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -700,7 +700,7 @@ Figwheel, etc), unless you've set `cider-default-cljs-repl'."
700700
;; original Clojure REPL. Our solution is to bump the original REPL back
701701
;; up the list, so it takes priority on Clojure requests.
702702
(cider-make-connection-default client-buffer)
703-
(setq cider-repl-type "cljs")
703+
(cider-repl-set-type "cljs")
704704
(pcase cider-cljs-repl-types
705705
(`(,name ,_ ,info)
706706
(message "Starting a %s REPL%s" name (or info ""))))
@@ -838,7 +838,7 @@ the appropriate REPL type in the end."
838838
(interactive)
839839
(when-let* ((conn (call-interactively #'cider-connect)))
840840
(with-current-buffer conn
841-
(setq cider-repl-type "cljs"))))
841+
(cider-repl-set-type "cljs"))))
842842

843843
(defun cider-current-host ()
844844
"Retrieve the current host."

0 commit comments

Comments
 (0)