Fork me on GitHub
#cider
<
2018-08-07
>
stbgz00:08:10

hey all I am seeing this error while starting up cider

Caused by: java.lang.RuntimeException: Unable to resolve var: cemerick.piggieback/wrap-cljs-repl in this context
    at clojure.lang.Util.runtimeException(Util.java:221)
    at clojure.lang.Compiler$TheVarExpr$Parser.parse(Compiler.java:720)
    at clojure.lang.Compiler.analyzeSeq(Compiler.java:7003)
brand new lein new reagent template app

stbgz00:08:21

has anyone see this error before?

dpsutton00:08:56

substitute the cemerick.piggieback dep for cider.piggieback

dpsutton00:08:20

[cider/piggieback "0.3.8"]

dpsutton00:08:49

also if you see something like :nrepl-middleware [cider.piggieback/wrap-cljs-repl] make sure its using cider.piggieback not cemerick piggieback

stbgz00:08:10

great tanks @dpsutton

dpsutton00:08:26

if it works you're welcome. if it doesn't work i'm sorry 🙂

bozhidar04:08:37

Guess someone should update this template.

bozhidar04:08:16

> Time to introduce Orchard to transducers. For no particular reason.

bozhidar04:08:43

@dominicm You’ve got it! 😉 Btw, I just removed 1.7 from the build matrix as the builds were taking forever. And it was actually piggieback which is really using something from 1.8, not Orchard (yet).

bozhidar04:08:05

@benedek There’s no incompatibility - from what I see some piggieback tests are failing to pass as the middleware descriptor is not properly set. It might be possible that for some reason in the tests piggieback required the tools.nrepl namespaces instead of the nrepl ones. Nothing else can produce such a problem IMO.

benedek07:08:11

ok thx @bozhidar will try to have a look

bozhidar07:08:40

You’re welcome! Basically this is the key thingy in the log:

lein test refactor-nrepl.ns.resolve-missing-test
[WARNING] No nREPL middleware descriptor in metadata of #'cider.piggieback/wrap-cljs-repl, see nrepl.middleware/set-descriptor!

bozhidar07:08:20

I guess if you dump the metadata you’ll see whether I was wrong.

bozhidar07:08:42

The tests afterwards fail simply because piggieback doesn’t start at all.

bozhidar07:08:02

It must the dep on cider-nrepl 0.18 which pulls and loads the old nREPL. I’ve updated this, so now I’m optimistic the tests will pass.

bozhidar08:08:49

@benedek Yay, the build is green again!

benedek08:08:53

will attempt a snapshot deployment then ;)

benedek08:08:23

nice teamwork haha :D

bozhidar08:08:39

Btw, what’s holding us back from finally cutting some release?

bozhidar08:08:04

Lars already deleted everything about hot-loading deps, so I guess we’re back in business, right?

benedek09:08:49

ha ok. sorry i am a bit behind tbh...

benedek09:08:21

shall we cut the last snapshot today then if all cool can cut a stable in a few days

benedek09:08:44

hopefully the same code as the snapshot

bozhidar09:08:27

Fine by me. 🙂

reefersleep10:08:49

I’ve made it a habit to delete the last paren of whichever sexp I’m working on, so that I can press RET without actually executing it. Is this the “right” way to do it, or is there a smarter way? It’s starting to feel a little repetitive with that “navigate to last closing paren -> delete it” manoeuvre all the time.

reefersleep10:08:00

In the CIDER repl, that is.

bozhidar10:08:13

I just use C-j.

reefersleep10:08:43

Great, just what I was looking for! Is it called anything?

bozhidar10:08:38

I think it’s called newline-and-indent or something like this. In paredit it’s paredit-newline.

reefersleep10:08:12

Cheers @bozhidar cider

bozhidar10:08:20

You’re welcome!

euccastro10:08:20

@reefersleep although some would argue that the "right" way to do it is to edit expressions in a (non-REPL) buffer and evaluate them / send them to the REPL from there

reefersleep10:08:52

@euccastro I’ve considered this approach as well, and I think I’ll give a it a go now, to see how it feels 🙂

reefersleep10:08:10

@euccastro regarding that approach; once I’m done editing a sexp, I usually end up just before the last paren, or somewhere deeper inside. IntelliJ has something like “send top form to REPL”, whereas in CIDER, I can only find “cider-send-last-sexp-to-repl”. It’s a bit of a hassle that I have to navigate to a specific point in my text before sending to the repl. Is there some better functionality that I can’t see?

bozhidar10:08:35

@reefersleep We’ve got a bit of weird terminology - `top-level form” is “defun” in CIDER (legacy from Elisp). Almost every command has a version that operates on the current form and the current top-level form.

bozhidar10:08:10

E.g. eval sexp is C-c C-e and eval defun is C-c C-c, etc.

reefersleep10:08:11

cider-eval-defun-at-point does what I want, then

reefersleep10:08:31

I’m experiencing leaps forward in my REPL efficiency and joy today 😄

reefersleep10:08:46

Cheers again! cider

dominicm11:08:45

if only you could compose actions and targets somehow? You could call them operators and text objects... troll

reefersleep12:08:43

Right? I use spacemacs in hope of getting the best of both world, but sometimes that means I’m fumbling around in a mishmash of two separate and, by themselves, streamlined paradigms. Pretty happy, though 🙂

dominicm12:08:54

I use vim for reals, I couldn't handle the two worlds colliding in spacemacs. I was searching for text objects & operators, and they didn't exist.

dominicm12:08:03

ended up worse than my vim setup, so I bailed.

reefersleep12:08:55

I may try to go back at some point. I’m just getting more and more config fatigue every day in my developer carreer, and spacemacs has been pretty good in that regard… Though, of course, not perfect. 🙂

dominicm12:08:48

spacemacs out of box is amongst the best, that's correct. I don't have that fatigue, quite happy tweaking things 🙂

bozhidar13:08:55

Not sure what those abstractions are, but I guess vim must have gotten something right. 😄

reefersleep13:08:56

@bozhidar I can’t believe you haven’t had someone try to mansplain the brilliance of vim to you yet… ? 😄

bozhidar13:08:32

I used to be a vim user, before I discovered Emacs. :_)

bozhidar13:08:30

This, however, was 15 years ago and I was a pretty basic vimmer at the time. I loved the navigation/editing experience, but I hated VimScript with a vengeance.

reefersleep13:08:15

Ah, alright 🙂 I switched to Emacs hoping to be boosted tool-wise by everyone else’s love of Elisp and hate of VimScript. But only because evil-mode is the best vim emulation that I know, otherwise I would still be fighting with installing Vim plugins 🙂 The text navigation and editing of Vim is superb, imo. Do you use evil-mode or something similar, then?

dominicm13:08:04

@bozhidar do you remember both y and w?

euccastro23:08:38

in spacemacs "evaluate expression before point" is , e e and "evaluate top-level form at point" is , e f, so while this is not really implemented in terms of operators and text objects, it kind of feels like that. in cleverparens there is actually a "form" text object bound to f, further reinforcing the illusion (I can see how this could be dangerous). but I'll take spacemacs over vim for the same reasons I'll take Clojure over Scheme

euccastro23:08:08

even if I have to deal with emacs <-> vim impedance mismatches just like I have to deal with Java and JS ecosystems more than I'd like

euccastro23:08:21

as soon as someone comes with the perfect editor and language I'll be happy to switch, but I'm not holding my breath

euccastro23:08:36

because both the perfect (kernel for a) language and the perfect (kernel for an) editor will have to catch up with decades worth of work poured into emacs and Java/JS

euccastro23:08:10

(rant over) 😛

dpsutton13:08:45

@reefersleep I do the same thing with this:

;; make cider repl indent and newline on enter and eval on
;; control-enter

(define-key cider-repl-mode-map (kbd "RET") #'cider-repl-newline-and-indent)
(define-key cider-repl-mode-map (kbd "C-<return>") #'cider-repl-return)
this makes enter do a newline and control enter send the form. I cannot imagine using the repl without this change any longer

dpsutton13:08:45

also @reefersleep check out the "insert" commands map at C-c C-j. has commands to insert defun, expression, and region

dpsutton13:08:02

these are useful for that as well

(setq cider-invert-insert-eval-p t)
(setq cider-switch-to-repl-after-insert-p nil)
(setq cider-eval-toplevel-inside-comment-form t)

reefersleep13:08:44

@dpsutton the enter->newline, control+enter->send form is what I’m used to from my IntelliJ-using colleagues, as well 🙂 It’d probably make sense for me to remap this as well, so cheers! I’ll have a look at the other things!

dpsutton13:08:12

it makes working with multiline forms incredibly useful

reefersleep13:08:47

@dpsutton I’m trying to find the SPC foo bar entry into the C-c C-j menu, but I don’t know how to look for it, exactly

reefersleep13:08:00

(I use Spacemacs)

dpsutton13:08:19

i have no idea sorry

dpsutton13:08:10

cider-insert-defun-in-repl is the name of one of the functions

reefersleep13:08:30

Yeah, I can enter the menu with C-c C-j and see the function names in helm. Normally I use SPC foo bar, though, and I’d like to reuse that pattern, also because it is (re-)discoverable, as helm shows all of the foos and bars for each keypress.

reefersleep13:08:06

I can search shortcuts with SPC ?, I found out 🙂 And it turns out that cider-insert-commands-map is not mapped to a SPC foo barish sequence, only C-c C-j, which explains why I couldn’t discover it through normal means. However, now that I give the functions a thorough look, I see that they are the ones that I’ve been learning today 😄 and which are available through other sequences, such as SPC m s. Thanks a lot, it’s been great getting more intimate with CIDER today!

dpsutton14:08:42

next step is you customize CIDER to your needs. Then the next step is you identify a missing feature and submit a PR adding it for yourself and your fellow developers 🙂

myguidingstar15:08:12

I can connect a cljs buffer to cider and evaluate from there. But if the namespace has a huge list of other namespaces it depends on (those in :require), evaluating doesn't work and a temp buffer shows up with a list of namespaces

myguidingstar15:08:40

I guess it's something to do with js stack limit

myguidingstar15:08:06

can we do anything about it?

dpsutton15:08:13

what is huge in this case? I can't imagine stack limits and dep count being anywhere near each other

dpsutton15:08:44

do you have a namespace with 2000 required namespaces?

dpsutton15:08:48

i can't imagine why a list of namespaces would come up.

dpsutton15:08:05

can you explain more clearly how you are triggering this error and what you are evaluating?

dpsutton15:08:18

i think we might be jumping towards an unfounded conclusion

myguidingstar15:08:34

I just eval simple things to test cider connection

myguidingstar15:08:40

like (+ 1 2) 🙂

myguidingstar15:08:03

it works in a cljs file that is small

myguidingstar15:08:55

but in another file, it has the said behavior

dpsutton15:08:52

And how are you evaluating forms?

myguidingstar15:08:11

I eval with cider-eval-last-sexp, cider-eval-print-last-sexp etc

dpsutton15:08:24

And you said it pops up a new buffer? Is it just a list of name spaces or is there other text in it? Do you know the name of the buffer

myguidingstar15:08:06

the buffer (or is it a buffer?) disappers whenever I press any key

myguidingstar15:08:23

I don't see it's buffer name or status bar

myguidingstar15:08:59

maybe it's a special kind of popup? I don't know Emacs well

myguidingstar15:08:12

I use emacs prelude btw

dpsutton15:08:47

Can you post the exact form you are evaluating?

myguidingstar15:08:09

just (+ 1 2) really

bozhidar15:08:16

@myguidingstar Maybe you can show us some screenshot or a gif?

myguidingstar15:08:57

ok, wait a minute

dpsutton15:08:36

Oh you get a list of namespaces when you evaluate that form

myguidingstar15:08:34

actually it's a long buffer and I can't scroll up to see what's in the beginning

dpsutton15:08:53

how did you connect with CIDER?

dpsutton15:08:02

also, now that its a buffer does the buffer have a name?

dpsutton15:08:19

i'm not confident in what you are seeing to be able to answer what might be the cause

myguidingstar15:08:19

I have two cljs buffers as seen on the screenshot

myguidingstar15:08:46

I used cider-eval-print-last-sexp at the end of the expression (+ [] {}) in both these buffers

myguidingstar15:08:09

the buffer on the left succeded with the output string

myguidingstar15:08:54

the buffer on the right didn't and the popup is in the bottom of emacs

dpsutton15:08:15

can you try m-x nrepl-toggle-message-logging and try again? we can see what's going across the wire

dpsutton15:08:32

this will create a buffer called *nrepl-messages* or something similar so we can look at the traffic

dpsutton15:08:08

it looks like it is evaling the ns form and correctly returning nil. Did this evaluation pop up the results in the minibuffer as in your screenshot?

myguidingstar15:08:05

there was no result. When I tried (js/alert "abc") there wasn't such side effect in the browser, either

dpsutton16:08:59

how did you connect to the clojurescript project?

myguidingstar16:08:26

with a custom code: (require '[figwheel-sidecar.repl-api :as ra])(ra/cljs-repl)

myguidingstar16:08:03

I have a .dir-locals.el with this content

((nil
  (cider-default-cljs-repl . super-cljs)
  (cider-cljs-repl-types . ((super-cljs "(require '[figwheel-sidecar.repl-api :as ra])(ra/cljs-repl)")))))

myguidingstar16:08:17

(as in cider doc cljs guide)

myguidingstar16:08:54

then I just use cider-connect-cljs

myguidingstar15:08:50

(I killed the buffer before eval so I guess it's clean)

myguidingstar15:08:12

when I focus to other windows, Emacs automatically saves the file and the said popup "buffer" show the message "Wrote ..." https://i.imgur.com/XND8Kby.png

richiardiandrea20:08:57

Trying make build in the cider folder but it fails that cannot find sesman-browser

dpsutton20:08:50

update sesman. i believe that's a recent addition

richiardiandrea21:08:25

uhm does not seem to work weird

richiardiandrea21:08:32

oh I need to update cask deps

richiardiandrea21:08:32

uhm it tells me:

For more information about these matters, see the file named COPYING.
cask install
Some dependencies were not available: sesman, spinner, queue, pkg-info, clojure-mode, markdown-mode, buttercup, elisp-lint
Makefile:23: recipe for target 'elpa-emacs' failed
make: *** [elpa-emacs] Error 255

richiardiandrea22:08:25

solved, I had compiled with no gnutls

richiardiandrea23:08:56

also I had just moved to 18.04 and needed to blow ~/.emacs.d/.cask and all the other ones