Thanks. I got it working. I copied much of the code in client.jl. In the 
end I wrote the new mode directly into a copy of REPL.setup_interface.  
There is probably an easier way to get the REPL to start in the new mode 
rather than julia, but this was faster for me.  There were many details, eg 
to get warn and error colors working. For me, it would have been far easier 
to use a hook after the REPL is created, but before it runs. But, I guess 
there is probably not much demand for that.

I also copied four functions, changing only `Base.parse_input_line(line)' 
in each (to support dumb terminals, etc.),  to include a macro to 
post-process the AST.  Again, I don't know if there is any demand for 
adding a general facility for this.

John

On Friday, April 15, 2016 at 6:07:00 PM UTC+2, Keno Fischer wrote:
>
> You can call REPL.setup_inferface yourself and add your own REPL mode. You 
> can also look at 
> https://github.com/JuliaLang/julia/blob/master/base/client.jl to see how 
> the active_repl gets created.
>
> On Fri, Apr 15, 2016 at 9:16 AM, <lapeyre....@gmail.com <javascript:>> 
> wrote:
>
>> 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