I have some memory that dynapath was breaking this. You might try disabling it as documented here.
https://github.com/clojure-emacs/orchard#configuration-options
@bozhidar Any chance I can get you to weigh in on ^
Some problem with eval defun functionality. In some namespaces I can’t properly do repl based development as CIDER doesn’t seem to “see” anything I have declared and loaded already. Evaling the buffer works fine, but as soon as I eval region or defun, it doesn’t see things in the same namespace. I turned nrepl logging on and I see for the working one
(-->
id "28"
op "eval"
session "375f7ae0-c60a-417a-a9d8-cc4b9e442d65"
time-stamp "2021-04-28 08:09:47.045094000"
code "(defn oracle-db-config [config]
(if
(common.env/dev-mo..."
column 1
file "/Users/matti.uusitalo/projektit/allu/valvira-allu-konversio/..."
line 28
nrepl.middleware.print/print "cider.nrepl.pprint/pr"
nrepl.middleware.print/quota 1048576
nrepl.middleware.print/stream? nil
ns #("konversio.db" 0 12 (fontified t help-echo cider--help-echo cider-locals nil cider-block-dynamic-font-lock t face font-lock-type-face))
)
but for the ones not working I get
(-->
id "30"
op "eval"
session "375f7ae0-c60a-417a-a9d8-cc4b9e442d65"
time-stamp "2021-04-28 08:10:12.564574000"
code "(defn next-lupanumero [target-db used-numbers licence-type]
(loop [candidate nil]
(if-not (or (nil? candidate) (used-numbers candidate))
candidate
(recur
(format
\"%s%06d\"
licence-type
(:nextval (db/query target-db (format \"SELECT nextval('rekisteri.licence-number-%s\" licence-type))))))))
"
column 1
file "/Users/matti.uusitalo/projektit/allu/valvira-allu-konversio/..."
line 15
nrepl.middleware.print/print "cider.nrepl.pprint/pr"
nrepl.middleware.print/quota 1048576
nrepl.middleware.print/stream? nil
ns "user"
)
So it looks like it doesn’t understand the namespace correctly, as the ‘ns’ identifier points to “user” in the non-working namespace. The files are both in the same project and folder.
What could cause CIDER to get confused about the namespace like this?I think that's a known bug and it's actually in clojure-mode
, but as it was pretty rare I didn't pay it much attention.
My apologies. I misinterpreted it to being cider-related. I was navigating the code in Emacs and didn’t realize i’d switched to a different package. I reported an issue about it to Cider repo yesterday. https://github.com/clojure-emacs/cider/issues/3009 I just close the issue then. Sorry for extra hassle.
(cider-current-ns) seems to return the wrong namespace for the non working ones. It returns “user”
I figured this out. I had a space before the ns declaration. Cider doesn’t find the namespace declaration in that case
Given a project that 1. starts both a server 2. and manages the frontend cljs code 3. has a cljc code i'm not sure of how to achieve the common goal of being able to evaluate expression for both context (clj & cljs) forms. Here is the project in question https://github.com/drewverlee/garlic I'm guessing these cider docs contain most of the information I need https://docs.cider.mx/cider/usage/managing_connections.html. It seems likely that I want to somehow group files by FrontEnd (FE) and BackendEnd (BE) code. What does cider consider a "project?" I have always thought it looks at the directory with the .git folder. How are .cljc files treated? is it dependent on the context? As in i should put them in their own library and import them into the FE or BE project? If i do split the project, then I assume it would be just a matter of running `cider-jack-in-(clj or cljs)` respectively. Alternatively, is there a way to keep clj and cljs in the same files and use cider-jack-in-clj&cljs? the backend code is responsible for starting a webserver: servering assets, responding to api calls, etc... The front end code, if i understand figwheel-main correctly, needs to either launch a new (or should it be sibling) nrepl server, with piggieback middleware (because i can't run cider-jack-in here). What I have tried is firstly (different from the github link) to temporarly moving all my alias deps to :deps
com.bhauman/figwheel-main {:mvn/version "0.2.11"}
cider/piggieback {:mvn/version "0.5.1"}
org.clojure/clojurescript {:mvn/version "1.10.764"}
to avoid extra complications with alias and my .dir-locals.el as i'm worried this second clojurescript-mode expression isn't valid
(
(clojure-mode . ((cider-clojure-cli-aliases . "-A:cljs")))
(clojurescript-mode . ((cider-clojure-cli-aliases . "-A:fig")))
)
Then
1. cider-jack-in-clj, correctly starts nrepl clj server. then starting my server.
2. cider-connect-sibling which produces another Nrepl buffer. However trying to evaluate anything results in a "nrepl-send-sync-request: sync nREPL request timed out).
At this point i feel my further guesses would be somewhat random and i'm hoping someone can give advice.We have a backend in clojure and frontend in clojurescript in one repo with a lot of shared cljc source code between the two. The frontend has its own alias in deps.edn, but otherwise there's no separation between the two. I use jack-in to start a clojure repl, and connect to a running cljs repl started by shadow-cljs. Cider uses the "most recent" repl when evaluating buffers or s-expressions where "most recent" is whichever had focus most recently.
thanks. cider-jack-in-clj&cljs unfortanltly doesn't just work.
hopefully looking at this fresh today makes it clear
i guess my next step is breaking the project into two projects and see if that just works.