Fork me on GitHub
#cider
<
2019-02-09
>
noprompt00:02:05

Is there a way to specify an alias with cider-jack-in-clj?

dpsutton01:02:57

I think there's something like "cider-global-cli-args"? On mobile so I can't look it up right now

noprompt01:02:50

@dpsutton Yeah, there’s that, which I currently use, but I want to do something dynamic. Currently, I’ve resorted to

(advice-add 'cider-clojure-cli-jack-in-dependencies :filter-args 'prompt-for-cli-options)

noprompt01:02:17

A hack for sure. 🙂

noprompt01:02:39

Essentially I want to use cider-jack-in-clj but I’d like to have some fine grained control when I need it.

noprompt01:02:13

So far digging through the source hasn’t turned up a control like that but I could just be looking in the wrong place.

dpsutton01:02:55

i've looked at it and if you send a prefix arg to cider jack in you can set like everything manually

dpsutton01:02:31

i need to make a patch that double prefix does that and single prefix prints the jack in command in the minibuffer and lets you edit it as you like

dpsutton01:02:37

which is probably the easiest thing to do

dpsutton01:02:07

@@ -1156,6 +1156,12 @@ non-nil, don't start if ClojureScript requirements are not met."
                    (or inferred-type
                        (cider-select-cljs-repl)))))))
 
+(defcustom cider-edit-jack-in-command nil
+  "When truthy allow the user to edit the command"
+  :type 'boolean
+  :safe #'booleanp
+  :version '(cider . "0.19.0"))
+
 (defun cider--update-jack-in-cmd (params)
   "Update :jack-in-cmd key in PARAMS."
   (let* ((params (cider--update-do-prompt params))
@@ -1181,8 +1187,11 @@ non-nil, don't start if ClojureScript requirements are not met."
                           (and (null project-dir)
                                (eq cider-allow-jack-in-without-project 'warn)
                                (y-or-n-p "Are you sure you want to run `cider-jack-in' without a Clojure project? ")))
-                  (let* ((cmd (format "%s %s" command-resolved cmd-params)))
-                    (plist-put params :jack-in-cmd cmd)))
+                  (let ((cmd (format "%s %s" command-resolved cmd-params)))
+                    (plist-put params :jack-in-cmd (if (or cider-edit-jack-in-command
+                                                           (plist-get params :edit-jack-in-command))
+                                                       (read-string "jack-in command: " cmd t)
+                                                       cmd))))
               (user-error "`cider-jack-in' is not allowed without a Clojure project"))))
       (user-error "The %s executable isn't on your `exec-path'" command))))
 

dpsutton01:02:10

or something like this

dpsutton01:02:28

this dumps the jack in command to the minibuffer and lets you easily edit it

noprompt01:02:08

Nice! Thanks for sharing that @dpsutton.

dpsutton01:02:20

if you find something that works submit a patch

dpsutton01:02:41

i think putting this behind single prefix works best so its interactive and not dir locals which are dynamic but not enough

noprompt02:02:41

A prefix argument is nice. Another idea is to have an interactive function which always prompts sort of like sql-postgres etc. though I’d want to spend some time experimenting with that.

noprompt02:02:10

Essentially that’s what the hack I mentioned does. It just prompts for additional args.

dpsutton02:02:49

I'm for sure interested in what works well for you. I think lots of people want it. Bruce was interested in something like this too I think

noprompt02:02:07

I’m embarrassed to admit I don’t really use prefix args because, heh, I don’t know how to do that in evil. 😛

dpsutton02:02:15

Lots of different aliases during his dev

dpsutton02:02:26

Oh. I don't either I guess

noprompt02:02:44

Right. I was prompted to look in to this because I noticed :style/indent wasn’t being respected in a .cljs file.

noprompt02:02:04

Turned out my suspicion that it was related to not loading up the right :alias was the issue.

noprompt02:02:40

Now that I can specify -A:client (which is my cljs side of the house) the indention works out fine.

noprompt02:02:59

I’ll mess around with this a little more.

noprompt02:02:19

I have nothing to lose picking up a bit more elisp. 🙂

noprompt02:02:37

I always learn new tricks when I dig around in cider’s code too.

danieroux08:02:39

REBL is fun, and rickmoynihan/nrebl.middleware is working for me.

danieroux08:02:07

Has anyone started to think about what datafy could look like in cider?

Chase22:02:09

following a discussion on #beginners i put [cider/cider-nrepl "0.20.0"] in my project.clj file and ran lein deps and restarted a lein repl. When I use cider-connect I'm seeing this warning: WARNING: CIDER requires cider-nrepl to be fully functional. Many things will not work without it!

Chase22:02:15

Am I doing something wrong with that dependency? I put it under dependencies but also tried putting it like this: :repl {:plugins [[cider/cider-nrepl "0.20.0"]]} in it's own place. both attempts gave me that warning

Chase22:02:45

Now that I think about it, I'm not sure the warning was just obsolete, I couldn't think of a way to test it to make sure I had full cider nrepl goodness