Fork me on GitHub
#cider
<
2018-12-05
>
benzap14:12:51

Using boot with emacs calling cider-jack-in-cljs produces this error. Anyone seen this before? quickfix?

benzap14:12:32

Is it possible i'm missing something?

richiardiandrea16:12:20

Looks alright to me at first glance...I would check the dependency 🌲 because it seems somehow cljs.repl is missing...maybe. Do you have a bigger stack trace?

David Reno17:12:08

Given this project file, when I start my repl with lein ring server it presumably runs my ring handler in the specified namespace:

(defn -main []
  (jetty/run-jetty handler {:port 3000}))
. This works fine. When I start a cider session instead of running lein from the command line, I see this message and it doesn’t seem to run -main:
[nREPL] Starting server via /usr/local/bin/lein update-in :dependencies conj \[nrepl\ \"0.4.5\"\] -- update-in :plugins conj \[refactor-nrepl\ \"2.4.0\"\] -- update-in :plugins conj \[cider/cider-nrepl\ \"0.19.0-SNAPSHOT\"\] -- repl :headless :host localhost...
I’m sure I’m missing a couple of things, I’d appreciate any comments. My goal is to use cider in place of the command-line lein and have the jetty server run.

David Reno17:12:07

My best guess is that the project file key :main informs the REPL to automatically call -main and that maybe cider has a different REPL or something and can’t call -main automatically?

lispers-anonymous17:12:52

Cider will not run -main on startup. You can start cider and run -main manually. There is also M-x cider-run which will run the -main command in your project

David Reno18:12:49

@UDVJE9RE3, thanks! cider-run is the extra step I was missing. Still not clear to me what cider does differently WRT the REPL but I can figure that out over time.

lispers-anonymous18:12:18

It’s just starting a repl and not making any assumptions about what you want to do with it. I will usually have a separate user namespace with functions that has functions for me to start, stop, and restart a ring server that I use exclusively in cider. They will start ring and then return control to the repl so that I can continue to re-evaluate other forms as I work. Try playing around with different methods for working in cider and see what works for you

David Reno18:12:58

You don’t have any github links with that type of setup do you? I haven’t figured out how to do that “return control to the repl so that I can continue to re-evaluate other forms as I work” part.

lispers-anonymous18:12:43

I don’t unfortunately. It’s mostly been using component and compojure frameworks. Component has stuff for doing this for sure.

David Reno18:12:57

Thanks, I’ll look.

David Reno19:12:13

@UDVJE9RE3, with that link and others I’ve cobbled the following together which seems to do the following: 1. has a -main to start the server via lein and cider-run 2. :join? false seems to return to the repl and let me run other commands 3. (.start) and (.stop) let me restart the jetty server

(ns hello-ring.core
  (:require [ring.adapter.jetty :as jetty]
            [clojure.pprint :as pprint]))

(defn handler [request]
  {:status 200
   :headers {"Content-Type" "text/plain"}
   :body "hello world" })

(defonce -main (jetty/run-jetty #'handler {:port 3000 :join? false}))
;;(.stop -main)
;;(.start -main)
;;(str "hi")

lispers-anonymous19:12:00

That sounds about right. You may need :join? true for when you are starting from lein ring server. I believe it will start the server then exit immediately since there is nothing to block the main thread. Not 100% sure about that but you might want to test that out

macrobartfast17:12:44

when entering cider debug mode with, in my case, C-u C-M-x I get clojure.lang.LispReader$ReaderException: java.lang.RuntimeException: No reader function for tag dbg ... I've updated emacs to 26.1 and reinstalled leiningen with a new .lein to try to resolve this issue; most the posts online about this issue are from around 2015; thoughts?

macrobartfast19:12:10

so, I've replaced emacs; replaced my .lein; replaced my .m2 repo; replaced my .emacs.d and I'm still getting the 'No reader function for tag dbg' error... where else is state stored for emacs/lein/cider?

Chris20:12:34

Did it ever work for you?

alexyakushev20:12:02

@bozhidar Would you kindly rebuild cider-nrepl? I fixed a bug in compliment that may annoy people (it did me)

dominicm20:12:46

I think cider will need a release soon just to be compatible with 1.10

martinklepsch22:12:53

when jumping to a namespace with C-c C-. — is there a way to be able to edit and evaluate stuff in the context of that buffer? I often use this kind of workflow to debug/interact with library code

bozhidar23:12:49

@alexyakushev Done. 🙂

bozhidar23:12:57

> I think cider will need a release soon just to be compatible with 1.10

bozhidar23:12:09

True. I plan to cut something before the end of the month.

norman23:12:21

@martinklepsch You can toggle read only and edit/eval. You’ll get some annoying auto-save errors if you don’t turn that off, but otherwise it does work.

martinklepsch23:12:12

@U0954HGDQ if you happen to know the commands from the top of your head, please share :) I guess I can google edit stuff but not sure about eval

norman23:12:40

eval is the same as for your files

norman23:12:01

C-x C-e, for example, or whatever you normally use

norman23:12:32

M-x read-only-mode to make the buffer editable

martinklepsch23:12:50

Oh and I guess I might have to use sesman to connect the buffer to an existing repl session

martinklepsch23:12:22

I thought I tried the regular eval stuff earlier but I’ll give it another go tomorrow, thanks 🙌

norman23:12:47

And, of course, you can’t save

bozhidar23:12:03

I guess @martinklepsch is asking mostly because of the changes to session mapping in 0.18. He might have to associate buffers outside the current project manually.

norman23:12:12

Let me try real quick and verify it still works for me. I don’t do this every day, but it’s a fairly regular thing

norman23:12:21

yeah - works fine for me. M-. into something in a JAR dependency. M-x read-only-mode and then edit eval.

norman23:12:44

CIDER 0.18.1snapshot (package: 20181008.1547)

bozhidar23:12:21

That’s because the friendly sessions were added after 0.18. 🙂

norman23:12:49

Oh - I thought you were saying something changed in 0.18 to make this not work.

norman23:12:57

I’ve been doing this for … a long time.