clojure-emacs / squiggly-clojure

Flycheck checker for Clojure, using eastwood and core.typed.
GNU General Public License v3.0
205 stars 25 forks source link

Dependencies not being injected by `flycheck-clojure-setup` #47

Closed olessavluk closed 7 years ago

olessavluk commented 7 years ago

Hi,

Problem: When I execute M-x cider-jack-in proper dependencies not being injected

Starting nREPL server via /usr/local/bin/lein update-in :dependencies conj \[org.clojure/tools.nrepl\
\"0.2.12\"\ \:exclusions\ \[org.clojure/clojure\]\] -- update-in :plugins conj \[cider/cider-nrepl\
\"0.15.0-SNAPSHOT\"\] -- repl :headless...

SImilar (@manuel-uberti or the same?) problem - https://github.com/clojure-emacs/squiggly-clojure/issues/46#issuecomment-282084009

Attempt to diagnose

  1. Start emacs and open project
  2. run M-x eval-expression for cider-jack-in-dependencies and it returns Symbol’s value as variable is void: cider-jack-in-dependencies

And because of this variable is void, function flycheck-clojure-setup do not inject proper dependencies, because of condition on 201:14 which fails

Temporary workaround

  1. run M-x cider-jack-in
  2. now cider-jack-in-dependencies contains (("org.clojure/tools.nrepl" "0.2.12"))
  3. eval (flycheck-clojure-setup)
  4. now cider-jack-in-dependencies contains (("acyclic/squiggly-clojure" "0.1.9-SNAPSHOT")("org.clojure/tools.nrepl" "0.2.12")) and everything works fine

Environment my emacs.d - https://github.com/purcell/emacs.d

pnf commented 7 years ago

I imagine that you are auto-loading cider, so its definitions are not yet available when you flycheck-clojure-setup. How you configure emacs is up to you, but you'll need to have loaded cider before loading flycheck-clojure.

On Feb 26, 2017, at 5:09 PM, Oles Savluk notifications@github.com wrote:

run

olessavluk commented 7 years ago

But when I press C-h v there is a lot of cider-related variables https://i.imgur.com/6uRT9Bk.png But cider-jack-in-dependencies is still empty. Maybe cider no longer initializes this variable when loading? Here is my config file which loads all the Clojure-related stuff - https://github.com/purcell/emacs.d/blob/master/lisp/init-clojure-cider.el

Or do I need to change my emacs configuration? (I've been reading cider docs and haven't figured out what I'm doing wrong)

manuel-uberti commented 7 years ago

Maybe better to ping @bbatsov about this?

scottdw commented 7 years ago

The README suggests calling flycheck-clojure-setup when flycheck loads and also global-flycheck-mode after init. But doesn't specify that cider needs to be loaded as well (cider-jack-in-dependencies needs to be bound).

I think the solution would be to add `(require 'cider)' to your init file or calling flycheck-clojure-setup on cider load not flycheck load.

manuel-uberti commented 7 years ago

@scottdw thanks for the tip, calling flycheck-clojure-setup after CIDER fixed it.

olessavluk commented 7 years ago

@pnf and @scottdw you were right, cider needs to be loaded before. Thanks for your help!