-
Notifications
You must be signed in to change notification settings - Fork 14
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
Allow custom show
#14
Comments
I had some discussion in the linked PR, but asking in an issue probably makes more sense... Should this work as a startup.jl? I've tried a few variations with no luck. atreplinit() do repl
function compact_show(io::IO, m::MIME, x)
io = IOContext(io, :compact => true)
show(io, m, x)
end
try
@eval using ReplMaker
@async initrepl(Meta.parse,
repl=enablecustomdisplay(Base.active_repl, compact_show, stdout),
prompt_text="jul> ",
prompt_color=:magenta,
start_key=')',
mode_name="compact_mode"
)
catch
end
end |
So there are a couple of errors being swallowed by the atreplinit() do repl
function compact_show(io::IO, m::MIME, x)
io = IOContext(io, :compact => true)
show(io, m, x)
end
try
@eval using ReplMaker
@eval initrepl(Meta.parse,
prompt_text="jul> ",
prompt_color=:magenta,
start_key=')',
show_function=$compact_show,
mode_name="compact_mode"
)
catch e;
@warn e.msg
end
end However, it seems that the In the meantime, you could put this in your startup.jl: function enable_compact_mode()
function compact_show(io::IO, m::MIME, x)
io = IOContext(io, :compact => true)
show(io, m, x)
end
try
@eval begin
using ReplMaker
initrepl(Meta.parse,
prompt_text="jul> ",
prompt_color=:magenta,
start_key=')',
show_function=$compact_show,
mode_name="compact_mode"
)
end
catch e;
@warn e.msg
end
nothing
end and then once your repl starts you can just do julia> enable_compact_mode()
REPL mode compact_mode initialized. Press ) to enter and backspace to exit.
jul> 1.00000000000000000000000001
1.0 |
Thanks! I appreciate your taking the time to dig into this :) |
It'd be good if the user could supply a custom function other than
show
, or thier own IO / MIME type to be used whenshow
is called in a custom REPL mode.The text was updated successfully, but these errors were encountered: