Skip to content

Commit

Permalink
[#2305] Make it possible to disable the REPL type auto-detection
Browse files Browse the repository at this point in the history
That mostly a workaround for cases where the track-state REPL type
detection is not functioning properly (seems right now it's not
working properly for shadow-cljs).
  • Loading branch information
bbatsov committed Jun 21, 2018
1 parent bd606e3 commit 5bc9326
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
* Add new defcustom `cider-switch-to-repl-after-insert-p`: Set to prevent cursor from going to the repl when inserting a form in the repl with the insert-to-repl commands.
* Inject piggieback automatically on `cider-jack-in-clojurescript`.
* Introduce a new command named `cider` (`C-c M-x`) that acts as a simple wrapper around all commands for starting/connecting to REPLs.
* [#2305](https://github.com/clojure-emacs/cider/issues/2305): Make it possible to disable the REPL type auto-detection by customizing `cider-repl-auto-detect-type`.

### Bugs fixed

Expand Down
10 changes: 9 additions & 1 deletion cider-repl.el
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,14 @@ change the setting's value."
:group 'cider-repl
:package-version '(cider . "0.17.0"))

(defcustom cider-repl-auto-detect-type t
"Control whether to auto-detect the REPL type using track-state information.
If you disable this you'll have to manually change the REPL type between
Clojure and ClojureScript when invoking REPL type changing forms."
:type 'boolean
:group 'cider-repl
:package-version '(cider . "0.18.0"))

(defcustom cider-repl-use-clojure-font-lock t
"Non-nil means to use Clojure mode font-locking for input and result.
Nil means that `cider-repl-input-face' and `cider-repl-result-face'
Expand Down Expand Up @@ -234,7 +242,7 @@ This cache is stored in the connection buffer.")
(with-demoted-errors "Error in `cider-repl--state-handler': %s"
(when (member "state" (nrepl-dict-get response "status"))
(nrepl-dbind-response response (repl-type changed-namespaces)
(when repl-type
(when (and repl-type cider-repl-auto-detect-type)
(cider-set-repl-type repl-type))
(unless (nrepl-dict-empty-p changed-namespaces)
(setq cider-repl-ns-cache (nrepl-dict-merge cider-repl-ns-cache changed-namespaces))
Expand Down

3 comments on commit 5bc9326

@arichiardi
Copy link
Contributor

@arichiardi arichiardi commented on 5bc9326 Jun 21, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome, thanks for working on this 😉

@vspinu
Copy link
Contributor

@vspinu vspinu commented on 5bc9326 Jun 22, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why defcustom? This will likely be removed pretty soon when the bug is fixed.

@bbatsov
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just in case there are more related bugs down the road. 😄

Please sign in to comment.