This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2020-11-20
Channels
- # babashka (56)
- # beginners (151)
- # calva (3)
- # cider (31)
- # clj-kondo (17)
- # cljs-dev (5)
- # clojure (26)
- # clojure-australia (21)
- # clojure-dev (7)
- # clojure-europe (23)
- # clojure-nl (5)
- # clojure-spec (54)
- # clojure-uk (11)
- # clojuredesign-podcast (8)
- # clojurescript (77)
- # community-development (10)
- # core-typed (1)
- # cursive (3)
- # datomic (7)
- # docker (67)
- # emacs (10)
- # expound (6)
- # figwheel-main (3)
- # graalvm (67)
- # helix (10)
- # java (13)
- # jobs (6)
- # kaocha (4)
- # leiningen (15)
- # malli (2)
- # meander (31)
- # off-topic (40)
- # pedestal (9)
- # rdf (7)
- # reagent (5)
- # reitit (9)
- # remote-jobs (5)
- # shadow-cljs (94)
- # sql (7)
- # testing (12)
- # tools-deps (75)
- # vim (13)
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?
I think it'd be better to just add to your init.el
visiting the file in question and running cider-jack-in
.
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 ...
I get an error "wrong number of arguments".
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.
@lkottmann @bozhidar @jr0cket So this works: This starts a lein-repl in a separate session, then spacemacs with fiddle.clj and has cider connect to the repl. ... set oldwd $PWD cd ~/cloj-projects/fiddle/src/fiddle tmux new-session -d -s lein-repl lein repl :start :port 40000 &> out.log emacs --eval "(progn (sleep-for 15) (cider-connect-clj '(:host \"localhost\" :port 40000)))" fiddle.clj tmux kill-session -t lein-repl cd $oldwd ... I also tried this: emacs --eval "(cider-jack-in-clj '(:host \"localhost\" :port 40000)))" ~/cloj-projects/fiddle/src/fiddle/fiddle.clj ...but: - first it asks for confirmation "do you really want to run cider-Jack-in-clj?" - then I get an error "error in process sentinel: Could not start nREPL server:" Anyway, I'm happy. Thanks for your help!
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?
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.
[:button.bg-blue.hover:bg-blue-dark.text-white.font-bold.py-2 px-4.rounded "Button"]
@lkottmann @bozhidar @jr0cket So this works: This starts a lein-repl in a separate session, then spacemacs with fiddle.clj and has cider connect to the repl. ... set oldwd $PWD cd ~/cloj-projects/fiddle/src/fiddle tmux new-session -d -s lein-repl lein repl :start :port 40000 &> out.log emacs --eval "(progn (sleep-for 15) (cider-connect-clj '(:host \"localhost\" :port 40000)))" fiddle.clj tmux kill-session -t lein-repl cd $oldwd ... I also tried this: emacs --eval "(cider-jack-in-clj '(:host \"localhost\" :port 40000)))" ~/cloj-projects/fiddle/src/fiddle/fiddle.clj ...but: - first it asks for confirmation "do you really want to run cider-Jack-in-clj?" - then I get an error "error in process sentinel: Could not start nREPL server:" Anyway, I'm happy. Thanks for your help!
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
@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
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?
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.