Skip to content

Commit

Permalink
Merge pull request gcalderone#44 from wentasah/requires-jl
Browse files Browse the repository at this point in the history
docs: Suggest using Requires.jl for automatic settings of package options
  • Loading branch information
gcalderone authored May 25, 2021
2 parents 9327492 + 658e5f4 commit 04484ad
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions docs/src/options.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,12 +70,11 @@ Each line reports the package name (`GNUPLOT`), the session name (`default`), th

## Package initialization

If you use **Gnuplot.jl** frequently you may find convenient to collect all the package settings ([Options](@ref)) in a single place, to quickly recall them in a Julia session. A possibility is to put the following code in the `~/.julia/config/startup.jl` initialization file (further info [here](https://docs.julialang.org/en/v1/stdlib/REPL/)):
If you use **Gnuplot.jl** frequently you may find convenient to automatically apply the package settings ([Options](@ref)) whenever the package is loaded. A possibility is to use [Requires.jl](https://github.com/JuliaPackaging/Requires.jl) and put the following code in the `~/.julia/config/startup.jl` initialization file (further info [here](https://docs.julialang.org/en/v1/stdlib/REPL/)):
```julia
macro gnuplotrc()
return :(
using Gnuplot;

using Requires
@require Gnuplot="dc211083-a33a-5b79-959f-2ff34033469d" begin
@info "Custom Gnuplot initialization"
# Uncomment the following if you don't have the gnuplot
# executable installed on your platform:
#Gnuplot.options.dry = true;
Expand Down Expand Up @@ -103,13 +102,12 @@ macro gnuplotrc()

# Set the default linetypes
empty!(Gnuplot.options.init);
push!(Gnuplot.options.init, linetypes(:Set1_5, lw=1.5, ps=1.5));
push!(Gnuplot.options.init, Gnuplot.linetypes(:Set1_5, lw=1.5, ps=1.5));

# Initialize the gnuplot REPL using the provided `start_key`.
if Gnuplot.options.gpviewer;
Gnuplot.repl_init(start_key='>');
end;
)
end
```
At the Julia prompt you may load the package and the associated settings by typing:
Expand Down

0 comments on commit 04484ad

Please sign in to comment.