gcv / julia-snail

An Emacs development environment for Julia
GNU General Public License v3.0
235 stars 23 forks source link

Error showing value of type Plots.Plot{Plots.GRBackend} #121

Closed sjkobayashi closed 1 year ago

sjkobayashi commented 1 year ago

With the latest version of julia-snail and julia-snail-multimedia-enable set to t, I get an error when I try to use Plots.plot.

For example, running using Plots; plot(sin, 0, 2π) gives

Error showing value of type Plots.Plot{Plots.GRBackend}:
ERROR: "No client connections available"
Stacktrace:
  [1] send_to_client(expr::String, client_socket::Nothing)
    @ Main.JuliaSnail ~/.emacs.d/elpa/julia-snail-20230503.522/JuliaSnail.jl:932
  [2] send_to_client
    @ ~/.emacs.d/elpa/julia-snail-20230503.522/JuliaSnail.jl:930 [inlined]
  [3] send
    @ ~/.emacs.d/elpa/julia-snail-20230503.522/JuliaSnail.jl:750 [inlined]
  [4] display(d::Main.JuliaSnail.Multimedia.EmacsDisplay, #unused#::MIME{Symbol("image/png")}, img_raw::Plots.Plot{Plots.GRBackend})
    @ Main.JuliaSnail.Multimedia ~/.emacs.d/elpa/julia-snail-20230503.522/JuliaSnail.jl:754
  [5] display(d::Main.JuliaSnail.Multimedia.EmacsDisplay, mime::String, x::Any)
    @ Base.Multimedia ./multimedia.jl:216
  [6] display(d::Main.JuliaSnail.Multimedia.EmacsDisplay, img::Plots.Plot{Plots.GRBackend})
    @ Main.JuliaSnail.Multimedia ~/.emacs.d/elpa/julia-snail-20230503.522/JuliaSnail.jl:765
  [7] display(x::Any)
    @ Base.Multimedia ./multimedia.jl:328
  [8] #invokelatest#2
    @ ./essentials.jl:729 [inlined]
  [9] invokelatest
    @ ./essentials.jl:726 [inlined]
 [10] print_response(errio::IO, response::Any, show_value::Bool, have_color::Bool, specialdisplay::Union{Nothing, AbstractDisplay})
    @ REPL /usr/local/Cellar/julia/1.8.5/share/julia/stdlib/v1.8/REPL/src/REPL.jl:296
 [11] (::REPL.var"#45#46"{REPL.LineEditREPL, Pair{Any, Bool}, Bool, Bool})(io::Any)
    @ REPL /usr/local/Cellar/julia/1.8.5/share/julia/stdlib/v1.8/REPL/src/REPL.jl:278
 [12] with_repl_linfo(f::Any, repl::REPL.LineEditREPL)
    @ REPL /usr/local/Cellar/julia/1.8.5/share/julia/stdlib/v1.8/REPL/src/REPL.jl:521
 [13] print_response(repl::REPL.AbstractREPL, response::Any, show_value::Bool, have_color::Bool)
    @ REPL /usr/local/Cellar/julia/1.8.5/share/julia/stdlib/v1.8/REPL/src/REPL.jl:276
 [14] (::REPL.var"#do_respond#66"{Bool, Bool, REPL.var"#77#87"{REPL.LineEditREPL, REPL.REPLHistoryProvider}, REPL.LineEditREPL, REPL.LineEdit.Prompt})(s::REPL.LineEdit.MIState, buf::Any, ok::Bool)
    @ REPL /usr/local/Cellar/julia/1.8.5/share/julia/stdlib/v1.8/REPL/src/REPL.jl:857
 [15] #invokelatest#2
    @ ./essentials.jl:729 [inlined]
 [16] invokelatest
    @ ./essentials.jl:726 [inlined]
 [17] run_interface(terminal::REPL.Terminals.TextTerminal, m::REPL.LineEdit.ModalInterface, s::REPL.LineEdit.MIState)
    @ REPL.LineEdit /usr/local/Cellar/julia/1.8.5/share/julia/stdlib/v1.8/REPL/src/LineEdit.jl:2510
 [18] run_frontend(repl::REPL.LineEditREPL, backend::REPL.REPLBackendRef)
    @ REPL /usr/local/Cellar/julia/1.8.5/share/julia/stdlib/v1.8/REPL/src/REPL.jl:1248
 [19] (::REPL.var"#49#54"{REPL.LineEditREPL, REPL.REPLBackendRef})()
    @ REPL ./task.jl:484

If julia-snail-multimedia-enable set to nil, the plot works normally by showing a dedicated window.

danielmatz commented 1 year ago

I'm seeing the same thing with CairoMakie. I'm on Julia 1.8.4.

gcv commented 1 year ago

Sorry about that. Should be fixed in https://github.com/gcv/julia-snail/commit/679498c65157224ec136eb225f019f2612ca5818.

sjkobayashi commented 1 year ago

Thank you! It works now.