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

How does the suggestion for including in startup.jl work ?

Open ArbitRandomUser opened this issue 3 years ago • 1 comments

the suggested method is to add

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

now if we look at line 393 in client.jl we see

373  function run_main_repl(interacti
 ...
 ...
393 │   │   │   _atreplinit(active_repl)                                                       
394 │   │   │   REPL.run_repl(active_repl, backend->(global active_repl_backend = backend))    

_atreplinit gets called before REPL.run_repl , now there are lines inside initrepl like .. julia_mode = active_repl.interface.modes[1] will only work after REPL.run_repl has run (right?) .

My question is .. how is @async making this happen ? is this a "hack" such that run_repl is able to setup_interface and all other initializations that initrepl needs before @async initrepl is accessing them , what if the async reaches something(for eg line 68 julia_mode = ...) that has not been initialized by REPL.run yet ?

ArbitRandomUser avatar Jun 01 '22 20:06 ArbitRandomUser

Are you able to get that to work? For some reason even if I put that code in my startup, I'm not able to enter the REPL mode. I'm on 1.9-rc1

anandijain avatar Mar 08 '23 13:03 anandijain