This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2021-04-29
Channels
- # babashka (168)
- # beginners (60)
- # calva (21)
- # cider (44)
- # clj-kondo (27)
- # cljs-dev (4)
- # cljsrn (2)
- # clojure (157)
- # clojure-australia (27)
- # clojure-bay-area (7)
- # clojure-czech (1)
- # clojure-europe (94)
- # clojure-nl (2)
- # clojure-spec (3)
- # clojure-sweden (11)
- # clojure-uk (35)
- # clojurescript (19)
- # cursive (12)
- # events (1)
- # figwheel-main (1)
- # fulcro (28)
- # honeysql (7)
- # jackdaw (9)
- # kaocha (4)
- # keechma (1)
- # malli (7)
- # midje (1)
- # missionary (1)
- # music (1)
- # off-topic (45)
- # pathom (18)
- # polylith (6)
- # practicalli (4)
- # random (1)
- # reagent (3)
- # reitit (3)
- # shadow-cljs (74)
- # sql (9)
I’m not a cider expert, but I’m trying to use it. I have a repl running in the repl buffer and I can type expressions and evaluate them
and I’ve opened a file.clj file.
but the .clj file seems to not be connected
so commands such as C-M-x have no effect
can someone explain what I’m doing wrong?
no, it’s in a different directory. It is in a directory of files where I’m preparing a presentation. The presentation slides are not inside the clojure project.
BTW, how do I know what directory the repl was started from? I didn’t directly start the repl, rather I used M-x cider-jack-in, but then that’s a completely different off-topic question.
well, that's is the reason, clj files must be on the class-path, just extend the classpath over it and restart the repl
how do I do that?
isn’t there a way just evaluate code from a file without incorporating a file into my project. I don’t really want the file in my project. the project does not depend on the file, rather the file depends on the project
of course I could fork the project just for the presentation, and remember never to merge the branch.
does the path interpreter understand “~/” ?
to evaluate code in a sparse file I think you could achieve it loading the file and evaluating it, not that is just your shell that expands it
the flow of my presentation is that I’ll cursor through the file, evaluating each top level form, looking at the printed result and talking to the audience about what happened or why certain errors occurred. the file is not loadable, as it contains intentional errors for pedagogical reasons
that’s reasonable, right?
I was considering just copy-pasting into the repl, but that makes for ugly indentation….
One solution could be just comment the intentional errors so as the reader does not parse them, another one could be using Emacs literate programming... that seems to fit neatly to you needs....
nice suggestions, all.
in the cider scratch buffer you should be able to paste code and evaluate it and pretty print results either on the repl or following the code declaration... easy to follow for an audience
1. for literate programming, does the file need to be in the project?
2. how can I go the scratch buffer direction? I know about the elisp scratch buffer
#2 is probably the easiest solution for my needs, as you said
Using a Scratchpad CIDER provides a simple way to create a Clojure scratchpad via the M-x `cider-scratch` command. This is a great way to play around with some code without having to create source files or pollute the REPL buffer and is very similar to Emacs’s own `*scratch*` buffer.
cider scratch is cool
C-M-x prints the result ephemerally with a => result which vanishes when I move the cursor. thats EXCELLENT
@jimka.issy you could also use sesman-link-* commands to tell cider to connect buffers which aren't in the project directory
Given a deps file with the aliases:
{:fig {:extra-deps
{com.bhauman/rebel-readline-cljs {:mvn/version "0.1.4"}
com.bhauman/figwheel-main {:mvn/version "0.2.11"}}
:extra-paths ["target" "test"]}...
and a dir-locals.el file (and a clean restart):
((clojurescript-mode . ((cider-clojure-cli-aliases . "-A:fig"))))
when i run 'cider-jack-in-cljs` i expect figwheel -main to be available, but it isn't.and now it is.
huh, maybe when i hit the command i wasn't in the cljs buffer?
ok fantastic, maybe all my woes are because i wasn't running cljs jack in the right right. I had considered the specific file mattered. That or something else wasn't aligned the way it is now.
Though i suppose this differs from the main project in that there is no server code to speak of.
You put the alias under clojurescript mode. So the mode of the file matters when jacking in. I’d change it to just nil so it’s always available