You could achieve this behaviour by using an `@async` function and checking 
until `isdefined(Base,:active_repl)`, like so:

function setup()
    @async while true
        if isdefined(Base,:active_repl)
            # enable LipsREPL
            LispREPL.initrepl(Base.active_repl)

            # enable sticky shell mode
            sticky_shell_mode(true)

            # enable CxxREPL
            !(v"0.4" <= VERSION < v"0.5-") && @eval using Cxx

            break
        else
            sleep(0.25)
        end
    end
end

My current full `.juliarc.jl`:


   - https://gist.github.com/Ismael-VC/7f44ff56aa53ab2df42dff81fa8feb52
   
Then I would try using `REPL.setup_inferface` as Keno mentions inside that 
async loop and have it execute and change to your repl as soon as 
`Base.active_repl` is instantiated.


El viernes, 15 de abril de 2016, 8:16:53 (UTC-5), [email protected] 
escribió:
>
> I have a REPL mode for an application: 
> https://github.com/jlapeyre/SJulia.jl/blob/master/src/sjulia_repl.jl
>
> I start julia in a terminal,  load the package with 'using SJulia', and 
> then press '=' to enter the alternative mode.  This works fine.
>
> I would like to do this in one step. e.g.  enter 'sjulia' in a terminal 
> and then start in the alternative mode. Problems are:
>
> 1. I have to execute a julia function to start the REPL mode 'after' the 
> REPL starts and I see the julia prompt. Otherwise there is no active REPL. 
> Using .juliarc.jl or julia -e apparently loads and runs code before 
> starting the REPL.  I would like the alternative REPL mode to be created 
> without entering anything at the julia prompt.
>
> 2. Once I create the alternative REPL, I am still in the standard julia 
> REPL mode. To switch to the alternative mode, I enter '='. I would like to 
> enter this mode automatically. There is a function Base.LineEdit.transition 
> that seems to do this. But, it takes a data structure (of type 
> Base.LineEdit.MIState' ) as an argument that I don't know how to get at.  I 
> can probably find it buried somewhere in Base.active_repl, but, I have not 
> been able to so far.
>
> -John
>

Reply via email to