To get the help mode, is "?" the only way?


#1

Can I get the help mode in some other way than by pressing the questionmark key?


#2

Docs.doc(binding, sig::Type) will give help on a function method, but doesn’t enter the help mode


#3

There is also the @doc macro which returns the docstring.


#4

That is true. However, the macro does not have the “fuzzy search” capability of the help mode:
image


#5

This is a good point. Unfortunately no search is possible, one either knows the precise binding and can use this, or is out of luck.


#6

The REPL help mode is implemented with the REPL.@repl macro:

julia> REPL.@repl coll
search: collect code_llvm @code_llvm Colon coalesce complex Complex ComplexF64 ComplexF32 ComplexF16 countlines code_lowered Cdouble Clonglong @code_lowered precompile functionloc cglobal Culonglong

Couldn't find coll
Perhaps you meant conj, copy, cos, cosc, cosd, cosh, cot, cotd, coth, ceil, cld, ccall, all, fill, foldl, kill, Bool, collect, Colon, Core, conj!, copy!, cospi, count, const, acos, acosd, acosh or acot
  No documentation found.

  Binding coll does not exist.

#7

And how do we find where REPL.@repl is defined?

Tried, but …

julia> @which REPL.@repl
WARNING: Base.REPL is deprecated, run `using REPL` instead
 in module Main
ERROR: no unique matching method found for the specified argument types

#8
julia> using REPL; @which REPL.@repl sum
@repl(__source__::LineNumberNode, __module__::Module, ex) in REPL at /Users/osx/buildbot/slave/package_osx64/build/usr/share/julia/stdlib/v1.0/REPL/src/docview.jl:274

i.e. ‘stdlib/REPL/src/docview.jl’

[Edit:]
But since I found the ripgrep (rg) tool I sometimes just grep the julia codebase, it’s almost instantaneous, i.e.

[snip]/julia (master)$ rg "macro repl" .
./stdlib/REPL/src/docview.jl
274:macro repl(ex) repl(ex) end
275:macro repl(io, ex) repl(io, ex) end

#9

Ah, thanks (I’d visited that file after some grepping but couldn’t find the right spot)