cider icon indicating copy to clipboard operation
cider copied to clipboard

Be able to supply extra opts to the clojure command that cider-jack-in starts

Open bhauman opened this issue 7 years ago • 4 comments

Is your feature request related to a problem? Please describe.

As I use Clojure tools more and more I have become quite accustomed to using Clojure tools alias options i.e -A:fig to customize my classpath depending on the REPL that I'm launching.

However when I try to launch a clojure REPL there is no way for me to provide these flags as easily as I do on the command line and I'd really like to. Having to use a prefix and then edit a lengthy command it somewhat cumbersome for something I need to do on almost every REPL launch.

Configuring flags with dir-locals dosn't solve the problem of using multiple flags in one project which is quite common.

Describe the solution you'd like

My suspicion is that it would be the best experience if I could provide extra args in the same prompt when I provide the REPL type clojure. I'd love to be able to instead type clojure -A:fig. My muscles have been trained to start clojure this way and I think it would be a natural UI for clojure users. I really feel like these aliases are getting to be a part of every clojure command I type.

If that doesn't work I'd love to simply have an extra prompt to provide these alias flags. And I'd like it to be a first class prompt that doesn't require a prefix but rather defaults to blank so that it's easily skipped.

bhauman avatar Oct 04 '18 15:10 bhauman

Agree with this and I thought you could already "append" to cider's cli string (might be only with a defcustom though, so yeah that's not as flexible).

This would solve also the following:

At the moment shadow's REPL is launched with npx shadow-cljs server and that is ok. Shadow can also be launched directly like npx shadow-cljs watch build-id params.

Among the params you can have -A for tools.deps aliases. Same deal as above :+1:

arichiardi avatar Oct 04 '18 15:10 arichiardi

My suspicion is that it would be the best experience if I could provide extra args in the same prompt when I provide the REPL type clojure.

Btw, that current happens only in case of ambiguities (normally CIDER infers the REPL type and starts whatever's appropriate for the current project). I guess one way to solve this would be to add a config to always prompt for the jack-in tool and extra jack-in params.

bbatsov avatar Oct 04 '18 16:10 bbatsov

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contribution and understanding!

stale[bot] avatar May 08 '19 16:05 stale[bot]

Btw, I remembered that we addressed this a certain extent in https://github.com/clojure-emacs/cider/pull/2586

bbatsov avatar Jun 12 '19 11:06 bbatsov

;; jack-in-cmd allows you full control over the command that starts the nrepl server process

(defun my-cider-jack-in-prompt-cmd (jack-in-cmd)
  (interactive "sJack in cmd: ")
  (cider-jack-in-clj
   (list :jack-in-cmd jack-in-cmd)))


;; I personally like to def a jack in function in elisp which I have somewhere,
;; for instance the readme of my project or dev.el

(defun ftlm-vehicles-make-nbb-nrepl-jack-in ()
  (interactive)
  (cider-jack-in-clj
   '(:jack-in-cmd "npx nbb nrepl-server"
                  :project-dir "/home/benj/repos/clojure/vehicles/")))

I made a presentation of the above (uploading rn):

https://youtu.be/IJuQm0aDVIo

@bhauman

benjamin-asdf avatar Oct 15 '23 08:10 benjamin-asdf

Thanks much, @benjamin-asdf!

Also, wow, this issue has been very much solved since long ago, I don't know how it escaped our efforts of not having stale issues open.

https://docs.cider.mx/cider/1.8/basics/up_and_running.html#clojure-cli-options

There's also defcustom cider-edit-jack-in-command.

vemv avatar Oct 15 '23 10:10 vemv