Welcome! Please see the About page for a little more info on how this works.

0 votes
in CIDER by

I want to do cider-jack-in but I want to run with some predefined arguments passed to the clojure executable.

Each time I do a cider-jack-in, I want to pick up my :aliases {:dev {:extra-deps ... :extra-paths ... }} as defined in my deps.edn

Current workaround is to open an xterminal and type,
clj -A:dev
Then from GNUEmacs do cider-connect

Since clj is just wrapping rlwrap around /usr/bin/clojure, i understand I can run clojure via CIDER, but what's the best way to get the argument, -A:dev, passed in, too.

I tried setq'ing various things to the GNUEmacs variable, cider-clojure-cli-aliases without success.

Versions I am using...

CIDER 1.2.0 (Nice)

GNU Emacs 27.1 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.24, cairo version 1.16.0)
of 2021-03-27, modified by Debian

1 Answer

+1 vote

You can find some documentation at https://metaredux.com/posts/2019/11/02/hard-cider-understanding-the-jack-in-process.html

For one-off commands you can use the prefix argument C-u to get prompted for the exact command to use, so C-u M-x cider-jack-in.

For a more permanent option, to set an alias for cider to use when invoking clojure you can use the cider-clojure-clj-aliases variable. From its documentation:

A list of aliases to include when using the clojure cli. Alias names
should be of the form ":foo:bar". Leading "-A" "-M" "-T" or "-X" are
stripped from aliases then concatenated into the
"-M[your-aliases]:cider/nrepl" form.

In your case: (setq cider-clojure-clj-aliases ":dev")

Additionally if you only want to set the value for a specific project and not globally you can make use of project-specific configuration via a .dir-locals.el file. More info here: https://docs.cider.mx/cider/config/project_config.html

Cesar, you suggest using `(setq cider-clojure-clj-aliases ":dev")`
When i look in the docs i only see the option `cider-clojure-cli-aliases` (so cli instead of clj)

I think that's what we should use! Greetz