Fork me on GitHub
#cider
<
2018-10-19
>
vigilancetech02:10:12

@dpsutton I was trying to use the use the cider-nrepl 0.19.0-SNAPSHOT with refactor-nrepl 2.4.0 and it didn't like it apparently.

Martin07:10:57

I’m having trouble running a cljs repl

Martin07:10:52

I have figwheel and piggieback setup in my dev profile:

Martin07:10:04

{:dependencies [[figwheel-sidecar "0.5.14"]
                                  [com.cemerick/piggieback "0.2.1"]]
                   :source-paths ["src" "env/dev"]
                   :cljsbuild    {:builds [
                                           {:id           "ios"
                                            :source-paths ["src" "env/dev"]
                                            :figwheel     true
                                            :compiler     {:output-to     "target/ios/index.js"
                                                           :main          "env.ios.main"
                                                           :output-dir    "target/ios"
                                                           :optimizations :none
                                                           :target :nodejs}}
                                           {:id           "android"
                                            :source-paths ["src" "env/dev"]
                                            :figwheel     true
                                            :compiler     {:output-to     "target/android/index.js"
                                                           :main          "env.android.main"
                                                           :output-dir    "target/android"
                                                           :optimizations :none
                                                           :target :nodejs}}
                                           #_($DEV_PROFILES$)]}
                   :repl-options {:nrepl-middleware [cemerick.piggieback/wrap-cljs-repl]}}

Martin07:10:18

[nREPL] Starting server via /usr/local/bin/lein update-in :dependencies conj \[org.clojure/tools.nrepl\ \"0.2.13\"\ \:exclusions\ \[org.clojure/clojure\]\] -- update-in :plugins conj \[refactor-nrepl\ \"2.4.0-SNAPSHOT\"\] -- update-in :plugins conj \[cider/cider-nrepl\ \"0.18.0-SNAPSHOT\"\] -- with-profile +dev repl :headless...
[nREPL] server started on 63506
[nREPL] Establishing direct connection to localhost:63506 ...
[nREPL] Direct connection to localhost:63506 established
error in process filter: user-error: Piggieback is not available.  See  for details
error in process filter: Piggieback is not available.  See  for details

Martin07:10:54

and (setq cider-lein-parameters "with-profile +dev repl :headless") in my init.el

bozhidar07:10:45

@martincharlesrichards You need cider/piggieback instead.

bozhidar07:10:16

The project artifact was changed when Chas handed it over to us.

Martin07:10:32

ah, thank you

Martin07:10:38

let me give that a try

Martin07:10:10

fixed! thank you

bozhidar09:10:15

You’re welcome!

klausharbo11:10:18

I’m working towards a deps.edn-based setup — can I start up a Cider session with -A aliases specified?

klausharbo11:10:31

Can’t seem to find it in the docs

dpsutton11:10:13

I'm surprised that works with figwheel 0.5.14. I thought 16 was the first with cider piggieback support

bozhidar14:10:36

@dpsutton The first with nREPL 0.4 support. 🙂

dpsutton14:10:51

ah i had it backwards. thanks

magra14:10:11

Hi, i updated packages and my repl is spewing a few screens of messages messages like the following: Boxed math warning, cider/inlined_deps/fipp/v0v6v13/corerrb_vector/v0v0v12/clojure/core/rrb_vector/nodes.clj:88:11 - call: public static boolean http://clojure.lang.Numbers.lt(long,java.lang.Object).

magra14:10:25

Seems to be working though.

magra14:10:51

cider-version: CIDER 0.19.0snapshot (package: 20181019.812)

dpsutton15:10:44

how old was your CIDER before?

dpsutton15:10:01

i bet you've been getting these warnings forever, they've just gone to the server process buffer rather than your repl

dpsutton15:10:12

ah. i see these are the inlined cider deps

mhcat15:10:12

I just started seeing this too fwiw

bozhidar15:10:00

@j0ni It’s from the upstream dep.

mhcat15:10:04

I also see a full exception at the end

bozhidar15:10:08

They have to fix the warnings themselves.

mhcat15:10:22

is that the same deal?

bozhidar15:10:48

That’s different.

mhcat15:10:57

worth a bug report?

bozhidar15:10:57

Seems a recent change is misbehaving.

bozhidar15:10:41

That’s the PR which introduced the problem (it added compatibility with Clojure 1.10).

bozhidar15:10:57

Don’t have time to debug this, but I assume the problem is trivial by looking at the stacktrace.

bozhidar15:10:28

@kharbo You can just change cider-clojure-cli-global-options.

timvisher17:10:57

I have an instance of emacs 25.1.1 install with cider 0.18.0. My project directory looks like this

vagrant@taps-tvisher1:/opt/code/docs/scripts/tap-generate-docs$ tree -I 'bin|test'
.
├── deps.edn
└── src
    └── tap_generate_docs.clj
and I'm editing tap_generate_docs.clj. When I M-x cider-jack-in RET, cider prompts me with Are you sure you want to run cider-jack-in' without a Clojure project?`. Is this a known issue or is there something I can do to fix it?

dpsutton17:10:07

you can eval this (clojure-project-dir (cider-current-dir)) to see what it thinks is going on directory wise

timvisher17:10:45

Thanks. Sec.

dpsutton17:10:12

and then (cider-project-type project-dir)

dpsutton17:10:39

ah. anything funky going on? sym links, remote systems, anything like that?

timvisher17:10:42

I guess I should also say that the buffer is TRAMP.

timvisher17:10:51

That would've been helpful to state up front facepalm 🙂

timvisher17:10:18

But with emacs 26.1/cider 0.17 this set up works fine.

dpsutton17:10:20

i have no experience with that. i can only point you towards places

dpsutton17:10:37

so you downgraded emacs and upgraded CIDER lol

timvisher17:10:47

Heh. Well this is for a friend who's not running my blessed config. 😛

timvisher17:10:12

But yes, essentially that's what's going on.

timvisher17:10:24

It would be nice if ELPA allowed installing previous versions.

dpsutton17:10:27

check out clojure-cache-project-dir'`

dpsutton17:10:41

that might be holding onto something before TRAMP is run. set that to nil if not already

dpsutton17:10:47

(defun clojure-project-dir (&optional dir-name)
  "Return the absolute path to the project's root directory.

Call is delegated down to `clojure-project-root-function' with
optional DIR-NAME as argument.

When `clojure-cache-project-dir' is t the results of the command
are cached in a buffer local variable (`clojure-cached-project-dir')."
  (let ((project-dir (or clojure-cached-project-dir
                         (funcall clojure-project-root-function dir-name))))
    (when (and clojure-cache-project-dir
               (derived-mode-p 'clojure-mode)
               (not clojure-cached-project-dir))
      (setq clojure-cached-project-dir project-dir))
    project-dir))

dpsutton17:10:53

i think this is what you need to step through

dpsutton17:10:21

possibly its cached locally and not aware to check remotely?

timvisher17:10:23

Oh. I have an idea now.

dpsutton17:10:30

good luck and update us for sure

timvisher17:10:35

I didn't know that cider had a direct dependency on clojure-mode.

dpsutton17:10:36

i'm sure a PR would be incredibly welcome.

timvisher17:10:42

Their version of clojure-mode is ancient.

dpsutton17:10:02

easy fixes are best fixes 🙂

timvisher17:10:13

So new nrepl claims to come up correctly but we fail to attach to it over localhost:<port>.

timvisher17:10:26

Which is probably definitely a weird TRAMP thing.

dpsutton17:10:16

so you've solved the first bug and now on to a second bug?

timvisher17:10:30

Yep. Downgrading to 0.17 gets us past that. So some regression.

dpsutton17:10:54

oh so the first bug is still present in 0.18? upgrading clojure-mode didn't solve it?

timvisher17:10:17

Sorry. No. We're past the first bug. It was a classic melpa v. melpa-stable problem.

timvisher17:10:29

I would've seen that if I had remembered the dependency. 🙂

dpsutton17:10:37

oh. the bug in 0.18 is in connecting over tramp

timvisher17:10:45

Appears to be yes.

dpsutton17:10:45

so you can work normally if you downgrade to 0.17

timvisher17:10:58

I can but he can't, it seems. 🙂

timvisher17:10:01

Still digging.

dpsutton17:10:09

works on my machine is the worst

timvisher17:10:34

This is why I have a carefully curated bash/emacs/etc. environment that is shared with all my coworkers so they don't have to think about it.

timvisher17:10:47

But my friend here doesn't feel like using that. 🙂

timvisher17:10:56

So we're getting an nrepl op error.

dpsutton17:10:28

ok. that sounds like a more familiar error. any plugins? older versions of clj-refactor?

dpsutton17:10:35

check lein profiles for offenders

timvisher17:10:37

Debugger entered--Lisp error: (error "Invalid byte opcode: op=183, ptr=2")
  signal(error ("Invalid byte opcode: op=183, ptr=2"))
  error("Invalid byte opcode: op=%s, ptr=%d" 183 2)
  cider-jack-in-command("clojure-cli")
  cider-jack-in(nil)
  funcall-interactively(cider-jack-in nil)
  #<subr call-interactively>(cider-jack-in nil nil)
  ad-Advice-call-interactively(#<subr call-interactively> cider-jack-in nil nil)
  apply(ad-Advice-call-interactively #<subr call-interactively> (cider-jack-in nil nil))
  call-interactively(cider-jack-in nil nil)
  command-execute(cider-jack-in)

timvisher17:10:18

I mean his emacs install has a bunch of stuff that I don't run so that could definitely be something. I could emacs -Q and get cider installed and see where we go.

dpsutton17:10:24

ah i think that's easy

dpsutton17:10:30

nuke *.elc files

dpsutton17:10:44

that looks like incompatible emacs byte code which results from emacs X compiling elc and emacs Y running

timvisher17:10:54

Ah. Interesting.

dpsutton17:10:11

you mentioned differing versions of emacs

timvisher17:10:16

I did. And actually now that you mention it I downgraded him to 0.17 by copying it out of my emacs 26 config. 🙂

dpsutton17:10:07

ah yeah. that'll do it

dpsutton17:10:19

source should be fine just wipe those elc files

timvisher17:10:16

Got it. We're in. Thank you for the help. 🙂

dpsutton17:10:36

if yall could take a minute to lodge a ticket about the tramp jack in regression it would be appreciated

dpsutton17:10:45

i've never really used tramp so i can't put the salient details in

Lyn Headley17:10:53

I have a cljs / figwheel project with an ns containing a simple spec: (s/def ::content string?). Is it expected that upon jacking in I would see the ns as an option to select from M-x cider-browse-spec ? Because I don't see it.

creese18:10:44

I upgraded Cider on Thursday and now this happens. I can’t jack in. Any ideas?

timvisher18:10:16

@creese You may be mixing melpa and melpa-stable reqs.

jeremy19:10:03

I am trying to set the following in spacemacs in the user-config but it doesn't seem to be working. Any idea how to go about debugging it? I have tried with

(progn (require 'cider-repl-mode-map) ...)
and without but nothing.
(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)

jeremy19:10:39

Maybe a spacemacs question?

dpsutton19:10:42

you can't require cider-repl-mode-map

jeremy19:10:29

cider-repl-mode instead?

dpsutton19:10:43

(require 'cider-repl)

dpsutton19:10:00

if you want to require the file that has that var do that with (require 'cider-repl), else just use the var

dpsutton19:10:39

since (defvar cider-repl-mode-map ...) is in cider-repl.el

dpsutton19:10:18

what error are you seeing?

jeremy19:10:41

No error, it just isn't binding.

dpsutton19:10:06

and those forms are in the init part of the use-package form in spacemacs?

dpsutton19:10:50

(use-package foo
  :init
  (setq foo-variable t))
(i am neither spacemacs nor use-package user)

jeremy19:10:09

That's beyond me. I'm pretty new at this. Lol

dpsutton19:10:03

fair enough

dpsutton19:10:15

so where in your config are you writing these statements

jeremy19:10:27

I have put them inside of (defun dotspacemacs/user-config () ...) which says it's called at the very end of the spacemacs init after layers config.

dpsutton19:10:59

ok. so what's happening (i think) is that use-package is lazy so even though the config has "run" it hasn't done anything (yet)

dpsutton19:10:15

so that variable cider-repl-mode-map isn't avaialble since the source hasn't been required yet

dpsutton19:10:27

so try

(require 'cider-repl)
(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)

jeremy19:10:58

So that's where I got

(progn
    (require 'cider-repl)
    (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))

dpsutton19:10:20

and when you evaluate that (if you know how) does it not add those bindings?

jeremy19:10:53

I'm not sure how to evaluate it. I just restarted emacs (or reloaded the spacemacs dotfile) and it didn't seem to bind them.

dpsutton19:10:28

no worries 🙂

dpsutton19:10:56

put your cursor at the closing ) and we want to run eval-last-sexp

dpsutton19:10:10

do you know how to invoke m-x? I'm not sure how to do that in spacemacs

dpsutton19:10:20

and in fact #spacemacs might prove more helpful

dpsutton19:10:26

at this point

jeremy19:10:37

Yep alt-x 😉

jeremy19:10:54

I can ask there though. I didn't realize it existed before posting here.

dpsutton19:10:05

so its the same. alt is "meta" which is the m in m-x

dpsutton19:10:52

yeah if you have questions about cider specific stuff i'm happy to help. i just think that channel will be able to quickly get you up and running with your config

jeremy19:10:59

Just to answer the last bit. I eval'd it and it worked. :thumbsup: I'll move this to that channel to figure out how to get it to load with the user-configs. I appreciate the help.

dpsutton19:10:01

awesome. yeah i'm sure there's a convention they can show you

👍 4