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.
maybe with emacs --eval (cider-connect ...) fiddle.clj
?
Thank you! What should I put as arguments to cider-connect? Is there documentation?
This will require you to have a running nREPL server.
I think it'd be better to just add to your init.el
visiting the file in question and running cider-jack-in
.
(assuming you always want to do the same thing when starting emacs)
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 ...
emacs --eval (cider-jack-in-clj) fiddle.clj
will probably work as well.
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.
So basically you can do something like (cider-connect-clj '(:host "localhost" :port 1234))
.
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.
Only cider-connect-*
accept host/port params. cider-jack-in starts a server and connects to it automatically.
In theory yes, in practice I get an error "wrong number of arguments" if I don't provide any argument.
Ok found it . I need to provide 'nil' as argument
@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.
Is there a way to have CSS autocomplete in Emacs, and specifically for Tailwindcss used in Hiccup?
[:button.bg-blue.hover:bg-blue-dark.text-white.font-bold.py-2 px-4.rounded "Button"]
I get an error "wrong number of arguments".
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.
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
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
AH nevermind, it's cider-repl-buffer-size-limit
@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
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?
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
Thanks I will take a look
Is there a way to collapse a rich comment form? I want to do this for a presentation
mind you, I'm not using spacemacs, but I do find some examples of that. I hope they translate to emacs / prelude as well?
aha, hs-minor-mode
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.