Fork me on GitHub
#cider
<
2017-12-18
>
gonewest81800:12:42

I use :repl-options :init in my ~/.lein/profiles.clj like so:

gonewest81800:12:33

{:user
  {:repl-options
    {:init (do (set! *print-length* 500)
               (set! *print-level* 10))}}}

drewverlee01:12:10

When i run cider-jack-in from spacemacs, its seems to be reading a different file then my .lein/profiles.clj. Any idea how i can figure out what the location of the file is?

dpsutton01:12:47

cider doesn't read that file at all. lein should read that file

dpsutton01:12:55

what makes you think that the wrong one is being read?

dpsutton01:12:01

ie, what symptoms are you seeing

dpsutton01:12:49

and does it read the correct one if you just run lein repl?

drewverlee01:12:12

hmm. What i’m seeing is when i run cider-jack-in. There is a some string output at the bottom of the screen that has what looks like information from a profiles.clj. Only it doesn’t have the same versions as are in my ~/.lein/profiles.clj. I haven’t had to look into this before so i have been happy ignorant.

dpsutton01:12:45

can you post the string? that's not sounding familiar

dpsutton01:12:08

and if you run lein deps :tree does it output the correct versions?

dpsutton01:12:29

it should be in the *Messages* buffer. what is the wrong version?

drewverlee01:12:42

This version in my ~/.lein/profiles.clj is [cider/cider-nrepl “0.16.0-SNAPSHOT”]. That one is 0.15. Whats troubling me is more that i can’t jack-in at all. When I try, i’m meet with a long wait an exception about like this:

java.lang.RuntimeException: Unable to resolve var: cider.nrepl.middleware.test/wrap-test in this context
I poked around and this problem seems to be resolved on later versions or cider.

dpsutton01:12:42

if you are using cider-jack-in, it manages its own dependencies so you don't need to specify one. have you updated cider in emacs? it always brings in the version of cider-nrepl that matches itself

dpsutton01:12:48

and these should basically always go in lockstep

drewverlee01:12:06

i’m on Cider 0.15snapshot and emacs 24.5 on spacemacs release 0.200.9 . Not sure thats relevant. I don’t recall manually messing with cider. I’m only having this issue on my mac, my desktop works fine. I recall trying to do a clean install of spacemacs, which i assume includes Cider and it not resolving the issue (repl not connecting, the above error message). To make things more confusing (to me) the error only appears in certain clojure projects.

drewverlee01:12:33

im going to figure out how to get the message buffer, as that might help.

dpsutton01:12:42

i'm still not following. why are you specifying a cider-nrepl version at all

drewverlee01:12:02

in my profiles.clj?

dpsutton01:12:26

and it looks like this works in clojure 1.8 and not clojure 1.9

dpsutton01:12:44

it was an abuse of the reader in 1.8 that no longer worked in 1.9

dpsutton01:12:52

you should be able to upgrade cider and it will work

dpsutton01:12:21

as far as I'm aware, you don't need to specify either cider-nrepl or refactor-nrepl anywhere. cider will take care of them

dpsutton01:12:30

im sorry you're running into these issues 🙂

dpsutton01:12:17

if you are using cider-jack-in. if you are using cider-connect, then it is just connecting to an existing repl and you have to make sure the middle ware are there yourself. does that make sense?

dpsutton01:12:40

recent versions should be 0.16-snapshot which will get the cider-nrepl version automatically

dpsutton01:12:09

here's a ticket about what I think is happening to you https://github.com/clojure-emacs/cider/issues/2081

drewverlee01:12:16

Yes. Though i need a better mental model for the REPL at some point. In your past message you said that if i upgrade cider then it should correct the problem (a symtom of which is the NullPointer Exception).

dpsutton01:12:27

so here's how it works

dpsutton01:12:43

when you say cider-jack-in, cider will crank up lein and make sure the right nrepl middlleware are present

dpsutton01:12:54

and it just dictates a version of cider-nrepl that matches itself

dpsutton01:12:04

so if you have cider 0.15, it asks for cider-nrepl 0.15

dpsutton01:12:21

and 0.15 nrepl has a bug in it so if you get a newer cider it will ask for a newer cider nrepl

dpsutton01:12:34

sorry it's so confusing but it's trying to "do what you need"

dpsutton01:12:07

And the symptom you are seeing is it not knowing what a function is (wrap-test) because that code has invalid syntax in clojure 1.9

drewverlee01:12:03

I updated everything and i’m connected. 🙂

dpsutton01:12:15

Awesome! Glad it worked and sorry it was a pain

drewverlee01:12:20

Well, i’m fairly sure i got myself into that mix. There was an issue with my emacs config so it wasn’t updating. Actually, what confused me the most was that when i went to update emacs i thought it was saying i was already on the latest version.

ghsgd217:12:24

Is there a way to have different highlighting of function and macros names?

dpsutton18:12:42

based on `cider-mode.el line 597:

,@(when macros
          `((,(concat (rx (or "(" "#'")) ; Can't take the value of macros.
                      "\\(" (regexp-opt macros 'symbols) "\\)")
             1 (cider--unless-local-match font-lock-keyword-face))))
      ,@(when functions
          `((,(regexp-opt functions 'symbols) 0
             (cider--unless-local-match font-lock-function-name-face))))

dpsutton18:12:18

it looks like macros get font-lock-keyword-face and functions get font-lock-variable-name-face. so there are two different ones for them

dpsutton18:12:09

in the theme i'm using, brin, these are defined and can be adjusted

dpsutton18:12:30

and these can be modified in the source they are defined in or in M-x customize-group faces, custom faces

dpsutton18:12:36

that's really confusing looking elisp in the cider font lock compile function

ghsgd218:12:19

Thank you, @dpsutton!

dpsutton19:12:00

feel free to look at that source to see what other faces are used

dpsutton19:12:33

cider--compile-font-lock-keywords and emacs should let you jump there with C-h C-f