This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2019-04-09
Channels
- # announcements (4)
- # beginners (44)
- # boot (15)
- # calva (66)
- # cider (66)
- # clojure (75)
- # clojure-austin (4)
- # clojure-europe (2)
- # clojure-finland (1)
- # clojure-italy (3)
- # clojure-nl (10)
- # clojure-russia (3)
- # clojure-sg (1)
- # clojure-uk (109)
- # clojurescript (18)
- # datomic (8)
- # emacs (1)
- # figwheel-main (1)
- # fulcro (5)
- # jobs (1)
- # jobs-discuss (8)
- # kaocha (7)
- # leiningen (11)
- # luminus (2)
- # off-topic (69)
- # pathom (5)
- # re-frame (7)
- # reagent (4)
- # reitit (18)
- # ring-swagger (3)
- # shadow-cljs (123)
- # spacemacs (1)
- # sql (35)
- # tools-deps (89)
- # uncomplicate (3)
- # vim (6)
- # yada (3)
Is there a function that can take a region selection and wrap it in a let
that provides values for the free references?
(defun cider-debug-create-local-let (start end)
"During debugging, grab the locally bound vars and create a let
binding. Place this let binding in the kill ring for future use."
(interactive "r")
(if cider--debug-mode-response
(nrepl-dbind-response cider--debug-mode-response (locals)
(let* ((code (buffer-substring-no-properties start end))
(bindings (apply #'append locals))
(formatted-bindings (mapconcat 'identity bindings " ")))
(kill-new (format "(let [%s]\n %s)" formatted-bindings code))
(message "copied let form to kill ring")))
(message "No debugging information found.")))
there is also introduce let in clojure mode as a refactoring feature. does not do exactly what you asking for tho
A weird thing has been happening lately with a deps.edn/shadow-cljs project I am working on. This is what I do:
- shadow-cljs watch my-project
from the command line
- C-c C-x j j
to bring up a Clojure REPL
- M-x cider-connect-sibling-cljs
All I get is: user-error: ClojureScript is not available. See
ClojureScript is available though, because I can compile and watch the project via shadow-cljs with no problem.
Note also that I can bring up the CLJS REPL without a problem if connect to shadow-cljs nREPL via M-x cider-connect
and don't do a Clojure jack-in.
And another note: if I connect to shadow first and then I Clojure jack-in, I get 2 working REPLs (CLJ+CLJS).
> ClojureScript is available though, because I can compile and watch the project via shadow-cljs with no problem.
There’s a simple classpath check for this. Depending on your setup it might have failed resulting in this message.
I see, although I don't understand while connecting to shadow-cljs before jacking-in with Clojure works fine.
Not sure how the classpath looks exactly in your case. CIDER simply does a check for clojurescript-something.jar
being there.
I’ve added this in the past as some people were trying to run ClojureScript REPLs without having clojurescript as a dependency and were getting weird errors then.
There’s a similar discussion here - https://github.com/clojure-emacs/cider/issues/2308
That was my original plan, but for some reason I thought the classpath check would be simpler and faster to do (because it didn’t require code evaluation). Obviously I was wrong. 🙂
I also wanted to check the version of some libs and there was no generic way to do this via evaluation. But I definitely agree that’s a better course of action.
when i cider-eval-last-sexp of a (def something …) it works (i see the output in the buffer)
i think i also don’t understand disconnect between evaling things in source buffer and in the repl
so the caret is on the last ) not after it and it evaluates stuff inside (def …) not the def itself
@U0FU2H117 I'm not sure what other folks do for this, but personally I have semicolon bound to cider-eval-sexp-at-point. I actually put the cursor on the beginning of the thing I want to eval, rather than at the end. I'm pretty convinced that this is the best thing ever and everybody should do it but nobody else seems very impressed when I show them.
If you happen to be using spacemacs and you want to try it out, I defined it putting these two lines in my .spacemacs file, inside dotspacemacs/user-config
(evil-define-key 'normal clojurescript-mode-map ";" 'cider-eval-sexp-at-point)
(evil-define-key 'normal clojure-mode-map ";" 'cider-eval-sexp-at-point)