abo-abo / lispy

Short and sweet LISP editing
http://oremacs.com/lispy/
1.21k stars 132 forks source link

lispy-clojure throws with cider v.17 in a deps.edn project with Java9 #437

Open vkz opened 6 years ago

vkz commented 6 years ago

System: GNU Emacs 25.3.3 (x86_64-apple-darwin13.4.0, Carbon Version 157 AppKit 1265.21) of 2017-09-28

lib/lispy master 0.26.0-803-g501d1cf lib/cider master v0.17.0-30-gc40a020 lib/clojure-mode (detached) 5.7.0

AFAIK cider injects cider-nrepl 0.18.0-snapshot (while lispy-clojure depends or 0.16.0)

java --version java 9.0.1 Java(TM) SE Runtime Environment (build 9.0.1+11) Java HotSpot(TM) 64-Bit Server VM (build 9.0.1+11, mixed mode)

{:deps {}
 :aliases
 ;; workaround for java9 and libs that need java.xml.bind
 ;; e.g. to start a repl:
 ;; > clj -O:xmlbind -r
 ;; with cider you want to set manually or in dir-locals
 ;; cider-clojure-cli-global-options to "-O:xmlbind"
  {:xmlbind {:jvm-opts ["--add-modules=java.xml.bind"]}}}

Steps to reproduce: cider-jack-in works fine and lispy-eval works, too. kill or restart repl cider-jack-in lispy-clojure throws trying to require stuff e.g. compliment

I am very confused why it would work the first time but fail the next. The only way I found to fix this is by restarting Emacs :(

I played a bit with lispy-clojure ns and my best guess is that pomegranate fails to pull those deps on restart and basically doesn't play nicely either with tools.deps or with java9 or whatever. The reason I think so is that you can add these to deps in your deps.edn and lispy-clojure manages to require both compliment and fs:

compliment        {:mvn/version "0.3.6"}
me.raynes/fs      {:mvn/version "1.4.6"}

But then it fails at

(require '[cider.nrepl.middleware.util.java.parser :as parser])

which would've been fixed by adding the last version of cider-nrepl that had util.java.parser namespace

cider/cider-nrepl {:mvn/version "0.16.0"}

but sadly it breaks cider, which introduced tools.deps support in v17.

A bit too many moving parts for me to juggle, so I remain baffled by this. Would be grateful for any pointers.

vkz commented 6 years ago

One more note. I don't know why this is required, but on the off-chance that its important pls note that Java9 doesn't have tools.jar where you expect to find it:

(cemerick.pomegranate/add-classpath
  (expand-file-name "../lib/tools.jar" (System/getProperty "java.home")))