cider

A channel dedicated to the Clojure Interactive Development Environment that Rocks (aka CIDER). :cider:
niveauverleih 2020-11-20T07:26:21.061800Z

Is there a way to launch emacs so that it opens a given clojure file and automatically does the cider Jack-in? Sometimes I want to quickly try out some clojure command. I have a project "fiddle" with "fiddle.clj" under src. I want to place a shortcut on my desktop that launches spacemacs, opens fiddle.clj, starts a cider REPL and connects to it. I could run "emacs fiddle/stc/fiddle.clj" and "cd fiddle: lein repl"in parallel but that doesn't link my spacemacs session to the REPL.yet.

Louis Kottmann 2020-11-20T10:15:49.062700Z

maybe with emacs --eval (cider-connect ...) fiddle.clj ?

niveauverleih 2020-11-20T12:58:46.064100Z

Thank you! What should I put as arguments to cider-connect? Is there documentation?

bozhidar 2020-11-20T13:07:10.065200Z

This will require you to have a running nREPL server.

bozhidar 2020-11-20T13:08:01.066300Z

I think it'd be better to just add to your init.el visiting the file in question and running cider-jack-in.

bozhidar 2020-11-20T13:08:43.067500Z

(assuming you always want to do the same thing when starting emacs)

niveauverleih 2020-11-20T13:08:56.067900Z

Yes. I first start up the nrepl, then emacs like this: ... set oldwd $PWD cd ~/cloj-projects/fiddle/src/fiddle tmux new-session -d -s lein-repl lein repl &> out.log echo ",scj" | emacs fiddle.clj tmux kill-session -t lein-repl cd $oldwd ...

bozhidar 2020-11-20T13:09:11.068200Z

emacs --eval (cider-jack-in-clj) fiddle.clj will probably work as well.

bozhidar 2020-11-20T13:09:56.068500Z

cider-connect-clj is an autoloaded interactive Lisp function in
‘cider.el’.

(cider-connect-clj &optional PARAMS)

Initialize a Clojure connection to an nREPL server.
PARAMS is a plist optionally containing :host, :port and :project-dir.  On
prefix argument, prompt for all the parameters.

bozhidar 2020-11-20T13:10:31.069800Z

So basically you can do something like (cider-connect-clj '(:host "localhost" :port 1234)).

niveauverleih 2020-11-20T13:10:39.070Z

Sorry I meant ... set oldwd $PWD cd ~/cloj-projects/fiddle/src/fiddle tmux new-session -d -s lein-repl lein repl &> out.log emacs fiddle.clj tmux kill-session -t lein-repl cd $oldwd ... I will try your suggestion.

bozhidar 2020-11-21T11:52:11.083400Z

Only cider-connect-* accept host/port params. cider-jack-in starts a server and connects to it automatically.

niveauverleih 2020-11-21T11:54:15.083600Z

In theory yes, in practice I get an error "wrong number of arguments" if I don't provide any argument.

niveauverleih 2020-11-21T12:25:57.083800Z

Ok found it . I need to provide 'nil' as argument

niveauverleih 2020-11-21T13:37:33.084300Z

@jr0cket @bozhidar @lkottmann So here is my updated version ... set oldwd $PWD cd ~/cloj-projects/fiddle/src/fiddle emacs --eval "(cider-jack-in-clj nil)" fiddle.clj cd $oldwd ... Somehow you need to first cd into the directory of the file, otherwise the cider-jack-in-clj asks for confirmation.

erwinrooijakkers 2020-11-20T13:42:59.070600Z

Is there a way to have CSS autocomplete in Emacs, and specifically for Tailwindcss used in Hiccup?

erwinrooijakkers 2020-11-20T13:43:44.071100Z

[:button.bg-blue.hover:bg-blue-dark.text-white.font-bold.py-2 px-4.rounded "Button"]

niveauverleih 2020-11-20T13:44:28.071200Z

I get an error "wrong number of arguments".

2020-11-20T14:32:06.073Z

If you don’t find a company-backend on melpa; it’s relatively easy to write one yourself if you have a good list of everything you’d like to complete.

2020-11-20T15:47:07.074400Z

When I print a large data structure in the cider repl, it is printed but then instantly disappears. What's the setting to configure this? I think I set it to do this at some point but can't remember what the setting was

2020-11-20T16:14:00.075200Z

it seems to print a large thing out once or twice the first times I try but subsequently will revert to clearing the full repl after printing

2020-11-20T16:14:43.075400Z

AH nevermind, it's cider-repl-buffer-size-limit

practicalli-john 2020-11-20T17:09:54.079600Z

@jjttjj cider-inspect allows you to navigate and page through results. It will even follow your normal evaluations in the source code buffer. For example screenshots https://practicalli.github.io/spacemacs/evaluating-clojure/inspect.html

st3fan 2020-11-20T19:32:54.080300Z

How about a cider-yank-last-result ? I keep having trouble easily copying for example a string result from something I evaluated. Or is there a trick for that?

bozhidar 2020-11-21T11:51:12.083100Z

There's nothing currently built-in, but it'd be easy to do implement something. There's also a PR proposing something similar in progress https://github.com/clojure-emacs/cider/pull/2920

st3fan 2020-11-22T13:22:08.087600Z

Thanks I will take a look

borkdude 2020-11-20T20:51:46.080900Z

Is there a way to collapse a rich comment form? I want to do this for a presentation

borkdude 2020-11-20T20:53:35.081500Z

mind you, I'm not using spacemacs, but I do find some examples of that. I hope they translate to emacs / prelude as well?

borkdude 2020-11-20T20:55:39.081700Z

aha, hs-minor-mode

practicalli-john 2020-11-20T23:54:01.082400Z

I started using vimish-fold which can do very specific folding, but think that only works with Evil, so I don't think that helps, sorry. I found folding a bit basic otherwise.