ReplMaker.jl icon indicating copy to clipboard operation
ReplMaker.jl copied to clipboard

Fix startup script example in README.md

Open GHTaarn opened this issue 1 year ago • 2 comments

The example startup script was not legal Julia code, this is my suggested fix

GHTaarn avatar Mar 06 '23 04:03 GHTaarn

After testing this on Julia 1.8.5 I found that it also does not work as it throws a MethodError. The best solution that I could find that actually works is:

import ReplMaker

atreplinit() do repl
    try
        @async try
            ReplMaker.initrepl(
                apropos;
                prompt_text="search> ",
                prompt_color=:magenta,
                start_key=')',
                mode_name="search_mode"
            )
        catch e1
            @warn e1
        end
    catch e2
        @warn e2
    end
end

GHTaarn avatar Mar 06 '23 06:03 GHTaarn

Is @async really necessary? I found that it worked fine with just the following startup.jl:

import ReplMaker

atreplinit() do repl
    try
        ReplMaker.initrepl(
            apropos;
            prompt_text="search> ",
            prompt_color=:magenta,
            start_key=')',
            mode_name="search_mode"
        )
    catch e1
        @warn e1
    end
end

GHTaarn avatar Mar 06 '23 06:03 GHTaarn

Oops, thanks. The @async block is not necessary, but nice because it can get you into the REPL quicker if the startup takes a while.

MasonProtter avatar Apr 11 '24 14:04 MasonProtter