rebel-readline
rebel-readline copied to clipboard
Doc does not seem to work?
Hey Bruce, quick report :smile:
Example:
[Rebel readline] Type :repl/help for online help info
user=> (doc map)
CompilerException java.lang.RuntimeException: Unable to resolve symbol: doc in this context, compiling:(NO_SOURCE_PATH:1:1)
Compare with:
nREPL server started on port 43935 on host 127.0.0.1 - nrepl://127.0.0.1:43935
REPL-y 0.3.7, nREPL 0.2.12
Clojure 1.8.0
OpenJDK 64-Bit Server VM 1.8.0_171-8u171-b11-0ubuntu0.16.04.1-b11
Docs: (doc function-name-here)
(find-doc "part-of-name-here")
Source: (source function-name-here)
Javadoc: (javadoc java-object-or-class-here)
Exit: Control+D or (exit) or (quit)
Results: Stored in vars *1, *2, *3, an exception in *e
user=>
user=> (doc map)
-------------------------
clojure.core/map
([f] [f coll] [f c1 c2] [f c1 c2 c3] [f c1 c2 c3 & colls])
Returns a lazy sequence consisting of the result of applying f to
the set of first items of each coll, followed by applying f to the
set of second items in each coll, until any one of the colls is
exhausted. Any remaining items in other colls are ignored. Function
f should accept number-of-colls arguments. Returns a transducer when
no collection is provided.
nil
I launch rebel
with:
{:deps {org.clojure/clojure {:mvn/version "1.10.0-alpha4"}
com.bhauman/rebel-readline {:mvn/version "0.1.3"}}
...
:main-opts ["-m" "rebel-readline.main"]}
Hi @arichiardi
There are two ways you can do that on clojure rebel prompt.
-
By invoking the keybinding C-x C-d on the function name
-
Other way is to use clojure.repl namespace
=> (use 'clojure.repl)
=> (doc reify)
I hope this helps.
Oh, I thought it was kind of following the normal REPL bindings. Is this planned or do you want me close it.
I think shortcut is a good thing, though i am not sure if it is planned. I think a good way would be to start the repl with (use 'clojure.repl)
though i dont know how to do that when start a repl. Let this be open. I hope someone will tell us how to start deps.edn
with dependencies.
Yeah I ended up doing exactly that:
user=> (use 'clojure.repl)
nil
user=> (doc var)
-------------------------
var
(var symbol)
Special Form
The symbol must resolve to a var, and the Var object
itself (not its value) is returned. The reader macro #'x expands to (var x).
Please see http://clojure.org/special_forms#var
I really hope there is some way in ~/.clojure/deps.edn
to start repl with native dependencies.
Using this at the moment: https://gist.github.com/arichiardi/8ad47f5edf185876e82015739f038a22
Ideally rebel-readline.cljs.main
should do (use 'clojure.repl)
for me? Maybe?
Your alias doesnt seem to be working for me. My alias is the following for rebel readline:
alias cljrebl='clj -Sdeps "{:deps {com.bhauman/rebel-readline {:mvn/version \"0.1.3\"}}}" -J--add-modules -Jjava.xml.bind -m rebel-readline.main'
The Java XML bind is used because the latest Java version 10 deprecated java.xml so it needs to be required for clojure to work with latest java.
I didnt notice the accompanying deps.edn
this is good. Thanks!
Oh ok, you need alias + deps.edn
of course, it is working fine here, I did not want to include the rebel dep in the alias itself because of the escaping stuff.
You can use -e --eval
option to automaticity load lib and add it to namespace with use
So, to load rebel with docs from command line:
clj -Sdeps "{:deps {com.bhauman/rebel-readline {:mvn/version \"0.1.4\"}}}" -e "(use 'clojure.repl)(use 'clojure.java.javadoc)" -m rebel-readline.main
Or add this to your deps.edn :aliases :
:rebel {:extra-deps {com.bhauman/rebel-readline {:mvn/version "0.1.4"}}
:main-opts ["-e" "(use,'clojure.repl)(use,'clojure.java.javadoc)"
"-m" "rebel-readline.main"]}