Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Custom prompt incompatible with IPython prompt #325

Open
mbaz opened this issue Jun 2, 2023 · 0 comments
Open

Custom prompt incompatible with IPython prompt #325

mbaz opened this issue Jun 2, 2023 · 0 comments

Comments

@mbaz
Copy link

mbaz commented Jun 2, 2023

It seems it is not possible to have both the new IPython prompt in Julia 1.9, and a custom OhMyREPL prompt at the same time.

With this startup.jl, a custom prompt is displayed:

atreplinit() do repl
    if !isdefined(repl, :interface)
        repl.interface = REPL.setup_interface(repl)
    end
    REPL.numbered_prompt!(repl)
    try
        @eval using OhMyREPL
        @eval OhMyREPL.input_prompt!(() -> "("*splitpath(Base.active_project())[end-1]*") julia> ")
    catch e
        @warn "error while importing OhMyREPL" e
    end
end

Writing the if block below the try block results in the IPython prompt. So, it seems configuring one prompt overrides the other.

Interestingly, the Out dictionary is still enabled when the custom prompt is displayed, but it only records the last result:

(v1.9) julia> 1+1
2

(v1.9) julia> Out
Dict{Int64, Any} with 1 entry:
  0 => 2

(v1.9) julia> 2+2
4

(v1.9) julia> Out
Dict{Int64, Any} with 1 entry:
  0 => 4

Maybe a reasonable compromise would be to supress the In prompt when using a custom prompt, but still show a functional Out prompt.

@mbaz mbaz changed the title IPython prompt incompatible with custom prompt Custom prompt incompatible with IPython prompt Jun 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant