Is there any way to configure cider to start with clojure -X:dev instead of clojure -M:dev ?
You can change the initiation by using the prefix key before jacking in. If you need it permanent, you’ll to modify .dir-locals.el. There’s a section about it in the documentation of cider
I still don't see it, hmm. For instance, I tried:
((clojure-mode . ((cider-clojure-cli-aliases . ":dev:demo")
(cider-clojure-cli-parameters . "-X"))))
That gives me /usr/bin/clojure -Sdeps \{...\} -M:dev:demo:cider/nrepl -X
And I tried:
((clojure-mode . ((cider-clojure-cli-aliases . ":dev:demo")
(cider-clojure-cli-command . "clojure -X"))))
That gives me The clojure -X executable isn't on your 'exec-path'
And I tried:
((clojure-mode . ((cider-clojure-cli-parameters . "-X:dev:demo"))))
That gives me /usr/bin/clojure -Sdeps \{...\} -M:cider/nrepl -X:dev/demo , with Error in nREPL response dispatch: (user-error ClojureScript is not available. (my clojurescript dep is in :extra-deps in the :demo alias)Just scanning the docs, I actually don’t see the option; so I might be wrong 🫤 You could put ’:run {:exec-fn …’ in an alias I guess.
The command has to be a command without any params. Also, the jack-in command has to start the nREPL CLI. You might want to check out:
(defun cider-clojure-cli-jack-in-dependencies (params dependencies &optional command)
"Create Clojure tools.deps jack-in dependencies.
Does so by concatenating DEPENDENCIES and PARAMS into a suitable `clojure`
invocation and quoting, also accounting for COMMAND if provided. The main
is placed in an inline alias :cider/nrepl so that if your aliases contain
any mains, the cider/nrepl one will be the one used."
(let* ((all-deps (thread-last dependencies
(append (cider--jack-in-required-dependencies))
;; Duplicates are never OK since they would result in
;; `java.lang.IllegalArgumentException: Duplicate key [...]`:
(cider--dedupe-deps)
(seq-map (lambda (dep)
(if (listp (cadr dep))
(format "%s {%s}"
(car dep)
(seq-reduce
(lambda (acc v)
(concat acc (format " :%s \"%s\" " (car v) (cdr v))))
(cadr dep)
""))
(format "%s {:mvn/version \"%s\"}" (car dep) (cadr dep)))))))
(middleware (mapconcat
(apply-partially #'format "%s")
(cider-jack-in-normalized-nrepl-middlewares)
","))
(main-opts (format "\"-m\" \"nrepl.cmdline\" \"--middleware\" \"[%s]\"" middleware))
(deps (format "{:deps {%s} :aliases {:cider/nrepl {%s:main-opts [%s]}}}"
(string-join all-deps " ")
(if cider-enable-nrepl-jvmti-agent
":jvm-opts [\"-Djdk.attach.allowAttachSelf\"], "
"")
main-opts))
(deps-quoted (cider--shell-quote-argument deps command)))
(format "-Sdeps %s -M%s:cider/nrepl%s"
deps-quoted
(cider--combined-aliases)
(if params (format " %s" params) ""))))Probably we'll need to restructure it for someone to be able to do what you're interested in doing.