diff --git a/src/frontend/commands.c b/src/frontend/commands.c index 3fb5136d4..027b9a0d9 100644 --- a/src/frontend/commands.c +++ b/src/frontend/commands.c @@ -188,7 +188,7 @@ struct comm spcp_coms[] = { NULL, "[plotname] ... : Throw away all the data in the plot." } , { "setplot", com_splot, FALSE, TRUE, - { 0400, 0, 0, 0 }, E_DEFHMASK, 0, 1, + { 0400, 0, 0, 0 }, E_DEFHMASK, 0, 4, NULL, "[plotname] : Change the current working plot." } , { "setcirc", com_scirc, TRUE, FALSE, @@ -736,7 +736,7 @@ struct comm nutcp_coms[] = { NULL, "[plotname] ... : Throw away all the data in the plot." } , { "setplot", com_splot, FALSE, TRUE, - { 0400, 0, 0, 0 }, E_DEFHMASK, 0, 1, + { 0400, 0, 0, 0 }, E_DEFHMASK, 0, 4, NULL, "[plotname] : Change the current working plot." } , { "setcirc", com_scirc, TRUE, FALSE, diff --git a/src/frontend/postcoms.c b/src/frontend/postcoms.c index 2322592c0..425587071 100644 --- a/src/frontend/postcoms.c +++ b/src/frontend/postcoms.c @@ -1179,6 +1179,17 @@ DelPlotWindows(struct plot *pl) #endif } +/* Helper for com_splot(). */ + +static int new_str(wordlist **pwl, char **ps) +{ + *pwl = (*pwl)->wl_next; + if (!*pwl) + return 1; + tfree(*ps); + *ps = copy((*pwl)->wl_word); + return 0; +} /* * command 'setplot' @@ -1196,6 +1207,18 @@ com_splot(wordlist *wl) if (wl) { plot_setcur(wl->wl_word); + + if (cieq(wl->wl_word, "new")) { + /* The user may also supply, name, title and typename strings. + * The typename is the 'true name' used in commands! + */ + + if (new_str(&wl, &plot_cur->pl_typename)) + return; + if (new_str(&wl, &plot_cur->pl_title)) + return; + new_str(&wl, &plot_cur->pl_name); + } return; }