Skip to content

Centralize the call to finish_PS_module() such that no 'nothing' are passed in. #1757

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

Merged
merged 1 commit into from
Jul 4, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion src/GMT.jl
Original file line number Diff line number Diff line change
Expand Up @@ -422,7 +422,6 @@ using GMT.Laszip
#rm(joinpath(tempdir(), "GMTjl_custom_p_x.txt")) # This one gets created before username is set.
#arrows([0 8.2 0 6], limits=(-2,4,0,9), arrow=(len=2,stop=1,shape=0.5,fill=:red), axis=:a, pen="6p");
theme()
gmtinfo([1. 2 3])
plot(rand(5,2))
resetGMT()
end
Expand Down
2 changes: 1 addition & 1 deletion src/MB/mbgetdata.jl
Original file line number Diff line number Diff line change
Expand Up @@ -42,5 +42,5 @@ function mbgetdata(cmd0::String=""; kwargs...)
cmd = add_opt(d, cmd, "C", [:C :datatype :data_type], (sidescan="_0", amplitude="_a"))

cmd = "mbgetdata -I" * cmd0 * cmd # In any case we need this
finish_PS_module(d, cmd, "", true, false, false)
prep_and_call_finish_PS_module(d, cmd, "", true, false, false)
end
2 changes: 1 addition & 1 deletion src/MB/mbimport.jl
Original file line number Diff line number Diff line change
Expand Up @@ -55,5 +55,5 @@ function mbimport(cmd0::String=""; kwargs...)
cmd, arg1, arg2, = add_opt_cpt(d, cmd, [:N :color_amp], 'N', N_args, arg1, nothing)

cmd = "mbimport -I" * cmd0 * cmd # In any case we need this
finish_PS_module(d, cmd, "", true, false, false, arg1, arg2)
prep_and_call_finish_PS_module(d, cmd, "", true, false, false, arg1, arg2)
end
2 changes: 1 addition & 1 deletion src/MB/mblevitus.jl
Original file line number Diff line number Diff line change
Expand Up @@ -35,5 +35,5 @@ function mblevitus(cmd0::String=""; kwargs...)
((val = find_in_dict(d, [:z :z_down])[1]) === nothing) && (cmd *= " -z") # Means here default is Z-up
(!occursin("-:", cmd)) && (cmd = "-:" * cmd) # Means that the default here (contrary to C version) is speed-dept

finish_PS_module(d, "mblevitus " * cmd, "", true, false, false)
prep_and_call_finish_PS_module(d, "mblevitus " * cmd, "", true, false, false)
end
2 changes: 1 addition & 1 deletion src/MB/mbsvplist.jl
Original file line number Diff line number Diff line change
Expand Up @@ -34,5 +34,5 @@ function mbsvplist(cmd0::String=""; kwargs...)
(!occursin("-:", cmd)) && (cmd = " -:" * cmd) # Means that the default here (contrary to C version) is speed-dept

cmd = "mbsvplist -I" * cmd0 * cmd # In any case we need this
finish_PS_module(d, cmd, "", true, false, false)
prep_and_call_finish_PS_module(d, cmd, "", true, false, false)
end
18 changes: 17 additions & 1 deletion src/common_options.jl
Original file line number Diff line number Diff line change
Expand Up @@ -4385,14 +4385,30 @@ end
#is_this_type(type::DataType, arg) = isa(arg, type)
#validate_VMr(arg)::VMr = return isa(arg, VMr) ? arg : VMr[]

# ---------------------------------------------------------------------------------------------------
function prep_and_call_finish_PS_module(d::Dict{Symbol, Any}, cmd, opt_extra::String, K::Bool, O::Bool, finish::Bool,
arg1=nothing, arg2=nothing, arg3=nothing, arg4=nothing, arg5=nothing)
# This is a helper to avoid the long list of args in the finish_PS_module() call
case = (arg5 !== nothing) ? 5 : (arg4 !== nothing) ? 4 : (arg3 !== nothing) ? 3 : (arg2 !== nothing) ? 2 : (arg1 !== nothing) ? 1 : 0
if (case == 0) R = finish_PS_module(d, cmd, opt_extra, K, O, finish)
elseif (case == 1) R = finish_PS_module(d, cmd, opt_extra, K, O, finish, arg1)
elseif (case == 2) R = finish_PS_module(d, cmd, opt_extra, K, O, finish, arg1, arg2)
elseif (case == 3) R = finish_PS_module(d, cmd, opt_extra, K, O, finish, arg1, arg2, arg3)
elseif (case == 4) R = finish_PS_module(d, cmd, opt_extra, K, O, finish, arg1, arg2, arg3, arg4)
else R = finish_PS_module(d, cmd, opt_extra, K, O, finish, arg1, arg2, arg3, arg4, arg5)
end
end

# ---------------------------------------------------------------------------------------------------
finish_PS_module(d::Dict, cmd::String, opt_extra::String, K::Bool, O::Bool, finish::Bool, args...) =
finish_PS_module(d, [cmd], opt_extra, K, O, finish, args...)
function finish_PS_module(d::Dict, cmd::Vector{String}, opt_extra::String, K::Bool, O::Bool, finish::Bool, args...)
# FNAME_EXT hold the extension when not PS
# OPT_EXTRA is used by grdcontour -D or pssolar -I to not try to create and view an img file

#while (length(args) > 1 && args[end] === nothing) pop!(args) end # Remove trailing nothings
#if ((n = findlast(args .!= nothing)) !== nothing)
#args = args[1:n]
#end

reverse_plot_axes!(cmd) # If CTRL.pocket_J[4] != " " there is some work to do. Otherwise return unchanged

Expand Down
4 changes: 2 additions & 2 deletions src/geodesy/earthtide.jl
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ function earthtide(; kwargs...)
cmd = parse_opt_range(d, cmd, "T")[1]
if ((opt_S = add_opt(d, "", "S", [:S :sun_moon])) != "")
(dbg_print_cmd(d, cmd) !== nothing) && return cmd * opt_S
return finish_PS_module(d, cmd * opt_S, "", true, false, false)
return prep_and_call_finish_PS_module(d, cmd * opt_S, "", true, false, false)
elseif ((opt_L = add_opt(d, "", "L", [:L :location])) != "")
(dbg_print_cmd(d, cmd) !== nothing) && return cmd * opt_L
R = finish_PS_module(d, cmd * opt_L, "", true, false, false)
R = prep_and_call_finish_PS_module(d, cmd * opt_L, "", true, false, false)
R.colnames = ["Time", "East", "North", "Vertical"]
R.attrib = Dict("Timecol" => "1")
return R
Expand Down
3 changes: 1 addition & 2 deletions src/geodesy/psvelo.jl
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,7 @@ function velo(cmd0::String="", arg1=nothing; first=true, kwargs...)

# If file name sent in, read it and compute a tight -R if it was not provided
cmd, arg1, opt_R, = read_data(d, cmd0, cmd, arg1, opt_R)

finish_PS_module(d, proggy * cmd, "", K, O, true, arg1)
prep_and_call_finish_PS_module(d, proggy * cmd, "", K, O, true, arg1)
end

# ---------------------------------------------------------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion src/gmtinfo.jl
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ Parameters
- $(opt_write)
- $(opt_append)

To see the full documentation type: ``@? grdmask``
To see the full documentation type: ``@? gmtinfo``
"""
gmtinfo(cmd0::String; kwargs...) = gmtinfo_helper(cmd0, nothing; kwargs...)
gmtinfo(arg1; kwargs...) = gmtinfo_helper("", arg1; kwargs...)
Expand Down
4 changes: 2 additions & 2 deletions src/gmtlogo.jl
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ function logo(cmd0::String=""; first=true, kwargs...)
savefig = val
end
end
ret::Union{Nothing, String} = finish_PS_module(d, "psxy " * c * cmd, "", K, O, true, t)
ret::Union{Nothing, String} = prep_and_call_finish_PS_module(d, "psxy " * c * cmd, "", K, O, true, t)
(ret !== nothing && startswith(ret, "psxy")) && return ret
if (do_GMTjulia)
letter_height = 0.75 * r2 / 2.54 * 72 # Make the letters 75% of the cicle's diameter
Expand All @@ -81,7 +81,7 @@ function logo(cmd0::String=""; first=true, kwargs...)
end
else
(!occursin("-D", cmd)) && (cmd = " -Dx0/0+w5c " * cmd)
return finish_PS_module(d, "gmtlogo " * cmd, "", K, O, true)
return prep_and_call_finish_PS_module(d, "gmtlogo " * cmd, "", K, O, true)
end
end

Expand Down
6 changes: 3 additions & 3 deletions src/grdcontour.jl
Original file line number Diff line number Diff line change
Expand Up @@ -132,15 +132,15 @@ function _grdcontour_helper(cmd0::String, arg1, O::Bool, K::Bool, d::Dict)
d[:C] = isa(arg1, GMTcpt) ? arg1 : arg2
end

opt_extra = ""; do_finish = true
opt_extra = ""; finish = true
if (occursin("-D", cmd))
opt_extra = "-D"; do_finish = false; cmd = replace(cmd, opt_J => "")
opt_extra = "-D"; finish = false; cmd = replace(cmd, opt_J => "")
end

_cmd = ["grdcontour " * cmd]
_cmd = frame_opaque(_cmd, "grdcontour", opt_B, opt_R, opt_J) # No -t in frame
_cmd = finish_PS_nested(d, _cmd)
finish_PS_module(d, _cmd, opt_extra, K, O, do_finish, arg1, arg2, arg3)
prep_and_call_finish_PS_module(d, _cmd, opt_extra, K, O, finish, arg1, arg2, arg3)
end

# ---------------------------------------------------------------------------------------------------
Expand Down
6 changes: 3 additions & 3 deletions src/grdimage.jl
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ function _grdimage(cmd0::String, arg1, arg2, arg3, O::Bool, K::Bool, d::Dict)
(length(opt_J) > 3 && (opt_J[4] != 'X' && opt_J[4] != 'x')) && (cmd *= "r") # GMT crashes when just -D and proj
end

do_finish = false
finish = false
_cmd = ["grdimage " * cmd]
_cmd = frame_opaque(_cmd, opt_B, opt_R, opt_J; bot=false) # No -t in frame
if (!occursin("-A", cmd)) # -A means that we are requesting the image directly
Expand All @@ -133,13 +133,13 @@ function _grdimage(cmd0::String, arg1, arg2, arg3, O::Bool, K::Bool, d::Dict)
if (startswith(_cmd[end], "inset_") && isa(CTRL.pocket_call[4], String))
_cmd = zoom_reactangle(_cmd, false)
end
do_finish = true
finish = true
end

if (length(_cmd) > 1 && cmd0 != "") # In these cases no -R is passed so the nested calls set an unknown -R
for k = 2:lastindex(_cmd) _cmd[k] = replace(_cmd[k], "-R " => "-R" * cmd0 * " ") end
end
finish_PS_module(d, _cmd, "", K, O, do_finish, arg1, arg2, arg3, arg4)
prep_and_call_finish_PS_module(d, _cmd, "", K, O, finish, arg1, arg2, arg3, arg4)
end

# ---------------------------------------------------------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion src/grdvector.jl
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ function grdvector(arg1, arg2; first=true, kwargs...)
_cmd = frame_opaque(_cmd, opt_B, opt_R, opt_J) # No -t in frame
_cmd = finish_PS_nested(d, _cmd)
isbarbs && return d, _cmd, arg1, arg2, arg3 # If called by winbarbs return what we have
finish_PS_module(d, _cmd, "", K, O, true, arg1, arg2, arg3)
prep_and_call_finish_PS_module(d, _cmd, "", K, O, true, arg1, arg2, arg3)
end

# ---------------------------------------------------------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion src/grdview.jl
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ function grdview_helper(cmd0::String, arg1, O::Bool, K::Bool, d::Dict)
if (length(_cmd) > 1 && cmd0 != "") # In these cases no -R is passed so the nested calls set an unknown -R
for k = 2:lastindex(_cmd) _cmd[k] = replace(_cmd[k], "-R " => "-R" * cmd0 * " ") end
end
finish_PS_module(d, _cmd, "", K, O, true, arg1, arg2, arg3, arg4, arg5)
prep_and_call_finish_PS_module(d, _cmd, "", K, O, true, arg1, arg2, arg3, arg4, arg5)
end

# ---------------------------------------------------------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion src/mgd77/magref.jl
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ function magref_helper(arg1::GDtype, d::Dict{Symbol,Any})

cmd = "mgd77magref" * cmd
(dbg_print_cmd(d, cmd) !== nothing) && return cmd
finish_PS_module(d, cmd, "", true, false, false, arg1)
prep_and_call_finish_PS_module(d, cmd, "", true, false, false, arg1)
end

const mgd77magref = magref # Alias
3 changes: 1 addition & 2 deletions src/potential/gmtgravmag3d.jl
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,7 @@ function gravmag3d_helper(arg1, d::Dict{Symbol,Any})
end

(!occursin(" -F", cmd) && !occursin(" -G", cmd)) && (cmd *= " -G")

finish_PS_module(d, "gmtgravmag3d " * cmd, "", true, false, false, arg1, arg2, arg3)
prep_and_call_finish_PS_module(d, "gmtgravmag3d " * cmd, "", true, false, false, arg1, arg2, arg3)
end

const gmtgravmag3d = gravmag3d # Alias
Expand Down
2 changes: 1 addition & 1 deletion src/potential/grdseamount.jl
Original file line number Diff line number Diff line change
Expand Up @@ -38,5 +38,5 @@ function grdseamount_helper(arg1::GDtype, d::Dict{Symbol,Any})
end
end

finish_PS_module(d, "grdseamount " * cmd, "", true, false, false, arg1, arg2, arg3)
prep_and_call_finish_PS_module(d, "grdseamount " * cmd, "", true, false, false, arg1, arg2, arg3)
end
2 changes: 1 addition & 1 deletion src/psbasemap.jl
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ function basemap(; first=true, kwargs...)
#(IamModern[1] && opt_D != "") && @warn("The `inset` option is not available in modern mode. Please use the `inset()` function.")
_cmd = finish_PS_nested(d, [gmt_proggy * cmd])
CTRL.pocket_d[1] = d # Store d that may be not empty with members to use in other modules
finish_PS_module(d, _cmd, "", K, O, true)
prep_and_call_finish_PS_module(d, _cmd, "", K, O, true)
end

# ---------------------------------------------------------------------------------------------------
Expand Down
4 changes: 2 additions & 2 deletions src/psclip.jl
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ clip(; kwargs...) = clip_helper("", nothing; first=false, kwargs...
# ---------------------------------------------------------------------------------------------------
function clip_helper(cmd0::String, arg1; first=true, kwargs...)

gmt_proggy = (IamModern[1]) ? "clip " : "psclip "
proggy = (IamModern[1]) ? "clip " : "psclip "

d, K, O = init_module(first, kwargs...) # Also checks if the user wants ONLY the HELP mode

Expand All @@ -49,7 +49,7 @@ function clip_helper(cmd0::String, arg1; first=true, kwargs...)
# If file name sent in, read it and compute a tight -R if this was not provided
cmd, arg1, = read_data(d, cmd0, cmd, arg1, opt_R)

finish_PS_module(d, gmt_proggy * cmd, "", K, O, true, arg1)
prep_and_call_finish_PS_module(d, proggy * cmd, "", K, O, true, arg1)
end

# ---------------------------------------------------------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion src/pscoast.jl
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ function _coast(cmd0::String, O::Bool, K::Bool, clip::StrSymb, d::Dict)
end
end

R = finish_PS_module(d, _cmd, "", K, O, finish)
R = prep_and_call_finish_PS_module(d, _cmd, "", K, O, finish)
CTRL.pocket_d[1] = d # Store d that may be not empty with members to use in other modules
!isa(R, GDtype) && return R # If R is not a GMTdataset we are done.

Expand Down
2 changes: 1 addition & 1 deletion src/pscontour.jl
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ function contour_helper(cmd0::String, arg1; first=true, kwargs...)
# end

_cmd = finish_PS_nested(d, [gmt_proggy * cmd])
return finish_PS_module(d, _cmd, "-D", K, O, true, arg1, arg2, arg3)
prep_and_call_finish_PS_module(d, _cmd, "-D", K, O, true, arg1, arg2, arg3)
end

# ---------------------------------------------------------------------------------------------------
Expand Down
8 changes: 4 additions & 4 deletions src/pshistogram.jl
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ function histogram_helper(cmd0::String, arg1; first=true, kwargs...)
_cmd = fish_bg(d, _cmd) # See if we have a "pre-command" (background img)

# Plot the histogram
out1 = finish_PS_module(d, _cmd, "", K, O, true, arg1, arg2)
out1 = prep_and_call_finish_PS_module(d, _cmd, "", K, O, true, arg1, arg2)

# And if wished, plot the two vertical lines with the limits annotated in them
if (limit_L !== nothing)
Expand Down Expand Up @@ -288,17 +288,17 @@ function three_histos(d::Dict, I::GMTimage{UInt8, 3}, cmd, gmt_proggy, O, opt_T,

hst, _cmd = loc_histo(view(I, :, :, 1), _cmd, opt_T, opt_Z)
_cmd = replace(_cmd, "-G#0072BD" => "-Gred")
finish_PS_module(d, [_cmd], "", true, O, true, hst);
prep_and_call_finish_PS_module(d, [_cmd], "", true, O, true, hst)
O = true
hst, = loc_histo(view(I, :, :, 2), _cmd, "", "")
_cmd = replace(_cmd, "-Gred" => "-Ggreen")
(opt_B == DEF_FIG_AXES_BAK) && (_cmd = replace(_cmd, opt_B => " -Baf -BWsen"))
finish_PS_module(d, [_cmd * " -Y$(H)c"], "", true, O, true, hst)
prep_and_call_finish_PS_module(d, [_cmd * " -Y$(H)c"], "", true, O, true, hst)
hst, = loc_histo(view(I, :, :, 3), _cmd, "", "")
_cmd = replace(_cmd, "-Ggreen" => "-Gblue")

(d[:show] = show_; d[:fmt] = fmt_; d[:savefig] = savefig_) #
out = finish_PS_module(d, [_cmd * " -Y$(H)c"], "", true, O, true, hst)
prep_and_call_finish_PS_module(d, [_cmd * " -Y$(H)c"], "", true, O, true, hst)
end

# ---------------------------------------------------------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion src/psimage.jl
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ function image_helper(cmd0::String, arg1; first=true, kwargs...)

cmd, _, arg1 = find_data(d, cmd0, cmd, arg1) # Find how data was transmitted

return finish_PS_module(d, gmt_proggy * cmd, "", K, O, true, arg1)
prep_and_call_finish_PS_module(d, gmt_proggy * cmd, "", K, O, true, arg1)
end

# ---------------------------------------------------------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion src/pslegend.jl
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ function legend(cmd0::String="", arg1=nothing; first::Bool=true, kwargs...)
cmd *= opt_D
isa(arg1, NamedTuple) && (arg1 = text_record(Base.invokelatest(mk_legend, arg1)))
if (dbg_print_cmd(d, cmd) !== nothing) return cmd end
r = finish_PS_module(d, gmt_proggy * cmd, "", K, O, true, arg1)
r = prep_and_call_finish_PS_module(d, gmt_proggy * cmd, "", K, O, true, arg1)
gmt("destroy")
return r
end
Expand Down
3 changes: 1 addition & 2 deletions src/psmask.jl
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,7 @@ function mask(cmd0::String="", arg1=nothing; first=true, kwargs...)
end

cmd = add_opt_fill(cmd, d, [:G :fill], 'G')

return finish_PS_module(d, gmt_proggy * cmd, "", K, O, true, arg1)
prep_and_call_finish_PS_module(d, gmt_proggy * cmd, "", K, O, true, arg1)
end

# ---------------------------------------------------------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion src/psrose.jl
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ function rose_helper(cmd0::String, arg1; first=true, kwargs...)

_cmd = [gmt_proggy * cmd]
_cmd = frame_opaque(_cmd, opt_B, opt_R, opt_J) # No -t in frame
return finish_PS_module(d, _cmd, "", K, O, true, arg1, arg2)
prep_and_call_finish_PS_module(d, _cmd, "", K, O, true, arg1, arg2)
end

# ---------------------------------------------------------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion src/psscale.jl
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ function colorbar(arg1::Union{Nothing, GMTcpt}=nothing; first=true, kwargs...)
(opt_B != "" && !contains(cmd, " -L")) && (cmd *= opt_B) # If no -B & no -L, add default -B
isempty(opt_D) && (cmd *= " -DJMR") # So that we can call it with just a CPT

r = finish_PS_module(d, gmt_proggy * cmd, "", K, O, true, arg1)
r = prep_and_call_finish_PS_module(d, gmt_proggy * cmd, "", K, O, true, arg1)
(!isa(r,String)) && gmt("destroy") # Probably because of the rasters in cpt
return r
end
Expand Down
6 changes: 3 additions & 3 deletions src/pssolar.jl
Original file line number Diff line number Diff line change
Expand Up @@ -55,15 +55,15 @@ function solar(cmd0::String="", arg1=nothing; first=true, kwargs...)
cmd = add_opt(d, cmd, "T", [:T :terminators], (term="",date="+d",TZ="+z"))
cmd *= opt_pen(d, 'W', [:W :pen])

opt_extra = ""; do_finish = true
opt_extra = ""; finish = true
if (occursin("-I", cmd) || occursin("-I", cmd0))
opt_extra = "-I"; do_finish = false; cmd = replace(cmd, opt_J => "")
opt_extra = "-I"; finish = false; cmd = replace(cmd, opt_J => "")
end
_cmd = (opt_extra != "-I" && (!occursin("-M", cmd) && !occursin("-M", cmd0)) && (!occursin("-T", cmd) && !occursin("-T", cmd0))) ?
finish_PS_nested(d, [gmt_proggy * cmd]) : [gmt_proggy * cmd]
(length(_cmd) > 1 && startswith(_cmd[2], (IamModern[1]) ? "coast" : "pscoast") && !contains(_cmd[1], " -R") &&
contains(_cmd[2], " -R ")) && (_cmd[2] = replace(_cmd[2], "-R" => "-Rd")) # Apparently solar defaults to -Rd but only internally in C
return finish_PS_module(d, _cmd, opt_extra, K, O, do_finish, arg1)
prep_and_call_finish_PS_module(d, _cmd, opt_extra, K, O, finish, arg1)
end

# ---------------------------------------------------------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion src/pstext.jl
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ function _text(cmd0::String, arg1, O::Bool, K::Bool, d::Dict)

_cmd = [gmt_proggy * cmd]
_cmd = frame_opaque(_cmd, gmt_proggy, opt_B, opt_R, opt_J) # No -t in frame
r = finish_PS_module(d, _cmd, "", K, O, true, arg1, arg2)
r = prep_and_call_finish_PS_module(d, _cmd, "", K, O, true, arg1, arg2)
if (isa(r, String) && startswith(r, gmt_proggy)) # It's a string when called with Vd = 2 and it may be a nested call
isa(arg1, GDtype) && (CTRL.pocket_call[1] = arg1)
end
Expand Down
2 changes: 1 addition & 1 deletion src/pswiggle.jl
Original file line number Diff line number Diff line change
Expand Up @@ -86,5 +86,5 @@ function wiggle_helper(cmd0::String, arg1; first=true, kw...)

_cmd = [gmt_proggy * cmd]
_cmd = frame_opaque(_cmd, gmt_proggy, opt_B, opt_R, opt_J) # No -t in frame
finish_PS_module(d, _cmd, "", K, O, true, arg1)
prep_and_call_finish_PS_module(d, _cmd, "", K, O, true, arg1)
end
6 changes: 3 additions & 3 deletions src/psxy.jl
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ function _common_plot_xyz(cmd0::String, arg1, caller::String, O::Bool, K::Bool,

arg1, opt_S = parse_opt_S(d, arg1, is3D)
if (opt_S == "" && isa(arg1, GDtype) && !contains(cmd, " -S")) # Let datasets with point/multipoint geometries plot points
geom = isa(arg1, Vector) ? arg1[1].geom : arg1.geom
geom::Int = isa(arg1, Vector) ? arg1[1].geom : arg1.geom
((geom == wkbPoint || geom == wkbMultiPoint) && caller != "bar") && (opt_S = " -Sp2p")
end

Expand Down Expand Up @@ -250,7 +250,7 @@ function _common_plot_xyz(cmd0::String, arg1, caller::String, O::Bool, K::Bool,
isa(arg1, GDtype) && plt_txt_attrib!(arg1, d, _cmd) # Function barrier to plot TEXT attributed labels (in case)

finish = (is_ternary && occursin(" -M",_cmd[1])) ? false : true # But this case (-M) is bugged still in 6.2.0
R = finish_PS_module(d, _cmd, "", K, O, finish, arg1, arg2, arg3, arg4)
R = prep_and_call_finish_PS_module(d, _cmd, "", K, O, finish, arg1, arg2, arg3, arg4)
LEGEND_TYPE[1].Vd = 0 # Because for nested calls with legends this was still > 0, which screwed later
CTRL.pocket_d[1] = d # Store d that may be not empty with members to use in other modules
(opt_B == " -B") && gmt_restart() # For some Fking mysterious reason (see Ex45)
Expand Down Expand Up @@ -813,7 +813,7 @@ function helper_fish_bgs(val)::String
isa(arg2, GMTcpt) ? gmt("makecpt -T0/256/1 -C" * opt_H, arg2) :
gmt("makecpt -T0/256/1 -C" * string(arg2)::String * opt_I * opt_H)
image_cpt!(I, C)
CTRL.pocket_call[3] = I # This signals finish_PS_module() to run _cmd first
CTRL.pocket_call[3] = I # This signals finish_PS_module() to run _cmd first
end
FIG_MARGIN[1] = 0
return fname
Expand Down
Loading
Loading