I often create symbols (no args) or functions (with args) in which common options (and styles) are set in body and unique opts within args for managing multiple calls to built-in functions. these spit out a very friendly Sequence
object. But this still has a problem of creating symbols which in best practices should be kept at a bare minimized.
As a novice I recently discovered SetOptions[symbol, rules]
as it is cleaner, easier on the eyes, and much less prone to error than trailing a trainload of options inside each call to the same function. But one of the best things of all is that no new symbols are created.
As far as I know Options[symbol]
returns the original Mathematica default values only if SetOptions[symbol, rules]
was not previously changed.
To achieve what I want, I can only think to begin with a fresh kernel and, before anything loads, run something like this defopts = Options[symbol] /. List -> Sequence;
then, once done, reset the options with SetOptions[symbol, defopts]
.
I feel like resetting should be as simple as ResetOptions[symbol]
(similar to ResetDirectory
) while returning original non-default settings (for safety) along with the new current settings. If we only wish to view without any reset something like ResetOptions[symbol, False]
.
So, in short, is there a straightforward programmatic way of retrieving the originally defined default Options
For built in symbols, after these have been changed with SetOptions
? Is there an easy way to reset to the original default settings?
myOptions = {PlotRange -> All, AspectRatio -> Automatic}
) and add those to each function call. I find that it simplifies code reuse, since it is immediately clear that some defaults were changed. On the other hand, I find a remote and invisibleSetOptions
less user friendly. Passing a list of options, rather than a sequence, shouldn't be a problem, but you could useSequence @@ myOptions
if it is. This also does not require a reset, since you didn't change any defaults. $\endgroup$SetOptions
which i now prefer because no new symbols created. please go to (2 of 2). $\endgroup$SetOptions
on aButton
setting the easily viewable changedOptions
for{AutoAction->True, BaseStyle->{16,White,Bold}, Background->Black}
. i promise to give it an upvote and strong consideration for checkmark Accepted. $\endgroup$SetOptions[Plot, CloudEvaluate[Options[Plot]]]
$\endgroup$