From e264b27119f3fa72b48c77cb52607078ec6e45ec Mon Sep 17 00:00:00 2001 From: Giorgio Calderone Date: Sun, 19 Apr 2020 16:49:19 +0200 Subject: [PATCH] Comments updated --- src/Gnuplot.jl | 14 ++++++++++---- test/runtests.jl | 4 ++++ 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/src/Gnuplot.jl b/src/Gnuplot.jl index 80b11b4..ac444e6 100644 --- a/src/Gnuplot.jl +++ b/src/Gnuplot.jl @@ -742,8 +742,10 @@ end # ╰───────────────────────────────────────────────────────────────────╯ # --------------------------------------------------------------------- function enableExportThroughShow() - return (isdefined(Main, :IJulia) && Main.IJulia.inited) || - (isdefined(Main, :Juno) && Main.Juno.isactive()) + # Trick to check whether we are running in a IJulia or Juno + # session. Copied from Gaston.jl. + return ((isdefined(Main, :IJulia) && Main.IJulia.inited) || + (isdefined(Main, :Juno) && Main.Juno.isactive())) end @@ -756,8 +758,8 @@ function reset(gp::Session) gpexec(gp, "set output") gpexec(gp, "reset session") - # When running in IJulia or Juno set the unknown terminal - # (trick copied from Gaston.jl) + # When the `show()` method is enabled ignore options.term and set + # the unknown terminal if enableExportThroughShow() gpexec(gp, "set term unknown") else @@ -772,6 +774,10 @@ function reset(gp::Session) end end end + + # Note: the reason to keep Options.term and .init separate are: + # - .term can be overriden by enableExportThroughShow() + # - .init is dumped in scripts, while .term is not add_cmd.(Ref(gp), options.init) return nothing end diff --git a/test/runtests.jl b/test/runtests.jl index 97640f7..ee63682 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -245,4 +245,8 @@ Gnuplot.quitall() "splot x7, v, (u<0.5) ? -1 : sinc(x7,v) notitle", "splot x8, v, (u<0.5) ? -1 : sinc(x8,v) notitle", "splot x9, v, (u<0.5) ? -1 : sinc(x9,v) notitle") + + +@gp randn(10^6) randn(10^6) + Gnuplot.quitall()