Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add cider-clojurec-eval-destination custom variable #3387

Merged
merged 1 commit into from
Aug 1, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,9 @@
- [#3354](https://github.com/clojure-emacs/cider/issues/3354): Add new customization variable `cider-reuse-dead-repls` to control how dead REPL buffers are reused on new connections.
- `cider-test`: add timing information.
- `cider-test`: only show diffs for collections.
- `cider-test`: fail-fast by default, as controlled by the new `cider-test-fail-fast` defcustom.
- `cider-test`: fail-fast by default, as controlled by the new `cider-test-fail-fast` defcustom.
- Infer indentation specs when possible ([doc](https://docs.cider.mx/cider/indent_spec.html#indentation-inference)).
- Add new customization variable `cider-clojurec-eval-destination` to allow specifying which REPL CLJC evals are sent to.

### Bugs fixed

Expand Down
11 changes: 9 additions & 2 deletions cider-connection.el
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,14 @@ Possible choices are `prompt', `auto', `any', and nil.
(defconst cider-required-nrepl-version "0.6.0"
"The minimum nREPL version that's known to work properly with CIDER.")


(defcustom cider-clojurec-eval-destination 'multi
"The REPL type to be chosen in .cljc buffers."
:type '(choice (const :tag "Clojure" clj)
(const :tag "ClojureScript" cljs)
(const :tag "Multi (evaluate in Clojure and ClojureScript simultaneously)" multi))
:group 'cider
:package-version '(cider . "1.8"))

;;; Connect

(defun cider-nrepl-connect (params)
Expand Down Expand Up @@ -812,7 +819,7 @@ For the REPL type use the function `cider-repl-type'."
(with-current-buffer (or buffer (current-buffer))
(cond
((derived-mode-p 'clojurescript-mode) 'cljs)
((derived-mode-p 'clojurec-mode) 'multi)
((derived-mode-p 'clojurec-mode) cider-clojurec-eval-destination)
((derived-mode-p 'clojure-mode) 'clj)
(cider-repl-type))))

Expand Down
9 changes: 9 additions & 0 deletions doc/modules/ROOT/pages/cljs/up_and_running.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -118,3 +118,12 @@ going to be evaluated twice, once in each of the REPLs. In fact, you
can create multiple clj and cljs sibling connections (kbd:[C-c C-x C-s C-s/j]) within a CIDER session and evaluation will be directed
into all REPLs simultaneously. See xref:usage/managing_connections.adoc[Managing
Connections] for more details.

If you would prefer to evaluate `cljc` files in only one of the matching REPLs, you can customize the variable `cider-clojurec-eval-destination` to either `clj` or `cljs`. For example, to evaluate `cljc` files in the ClojureScript REPL only, add the following to your Emacs configuration:

[source,lisp]
----
(setq cider-clojurec-eval-destination 'cljs)
----

Note: This variable can also be set on a per-buffer basis using `setq-local`, or project-wide in `dir-locals.el`.
Loading