sw1nn
sw1nn

Reputation: 7328

How do I set local-paths for ritz.nrepl.middleware/wrap-javadoc?

In api docs for nrepl-middleware wrap-javadoc it says that it 'accepts local-paths a space separate list of paths'

How do I set this?

I've tried the following in my profiles.clj

{:user {:plugins []
    :jvm-opts ["-Xmx4G"]
    :injections [(require 'clojure.repl)]
    :warn-on-reflection true
    :dependencies [[ritz/ritz-nrepl-middleware "0.7.0"]]
    :repl-options {:nrepl-middleware 
                   [ritz.nrepl.middleware.javadoc/wrap-javadoc :local-paths "/usr/local/share/javadocs/7/docs/api"]
                   }}}

But that causes the following exception when I execute nrepl-jack-in

Starting nREPL server...
Mark set
error in process sentinel: nrepl-server-sentinel: Could not start nREPL server: Reflection warning, NO_SOURCE_PATH:1:483 - reference to field getLocalPort can't be resolved.
Exception in thread "main" java.lang.ClassCastException: java.lang.String cannot be cast to clojure.lang.IFn
    at clojure.core$comp$fn__4166.doInvoke(core.clj:2347)
    at clojure.lang.RestFn.invoke(RestFn.java:408)
    at clojure.tools.nrepl.server$default_handler.doInvoke(server.clj:89)
    at clojure.lang.RestFn.invoke(RestFn.java:436)
    at user$eval1192.invoke(NO_SOURCE_FILE:1)
    at clojure.lang.Compiler.eval(Compiler.java:6619)
    at clojure.lang.Compiler.eval(Compiler.java:6609)
    at clojure.lang.Compiler.eval(Compiler.java:6582)
    at clojure.core$eval.invoke(core.clj:2852)
    at clojure.main$eval_opt.invoke(main.clj:308)
    at clojure.main$initialize.invoke(main.clj:327)
    at clojure.main$null_opt.invoke(main.clj:362)
    at clojure.main$main$fn__6661.invoke(main.clj:440)
    at clojure.main$main.doInvoke(main.clj:437)
    at clojure.lang.RestFn.invoke(RestFn.java:421)
    at clojure.lang.Var.invoke(Var.java:419)
    at clojure.lang.AFn.applyToHelper(AFn.java:163)
    at clojure.lang.Var.applyTo(Var.java:532)
    at clojure.main.main(main.java:37)
Subprocess failed

If I wrap :local-paths "..." in a map I don't get any javadoc middleware

Upvotes: 2

Views: 222

Answers (1)

Ankur
Ankur

Reputation: 33637

If you look at the example of the nrepl-middleware on its github page, you will find that the vector to :nrepl-middleware sbould be a vector of middleware functions where as you are passing it a string path and that's why the exception "String cannot be cast to IFn".

As far as the local-paths is concerned that's something which is send by the nrepl client in the java-doc request itself. You can set local-paths in Emacs by calling:

(setq nrepl-ritz-javadoc-local-paths (list "/usr/local/share/javadocs/7/docs/api"))

Upvotes: 1

Related Questions