# Ensure that Options for built-in symbols are the original defaults

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?

• Define your own list of rules (e.g. 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 invisible SetOptions less user friendly. Passing a list of options, rather than a sequence, shouldn't be a problem, but you could use Sequence @@ myOptions if it is. This also does not require a reset, since you didn't change any defaults. Jun 6, 2022 at 12:29
• @MarcoB (1 of 2) i also define symbols (no args) or functions (args) for passing opts and styles. i tend to define all common non-defaults inside function body and call unique opts within args. they spit out a sequence object that always plays friendly. im still an MMA novice so i recently discovered SetOptions which i now prefer because no new symbols created. please go to (2 of 2). Jun 6, 2022 at 17:01
• @MarcoB (2 of 2) maybe i am doing something wrong but still works lol. i hope im not asking for too much. if you have a little free time would you mind in a proper Answer creating a simple concrete example of SetOptions on a Button setting the easily viewable changed Options for {AutoAction->True, BaseStyle->{16,White,Bold}, Background->Black}. i promise to give it an upvote and strong consideration for checkmark Accepted. Jun 6, 2022 at 17:04
• @MarcoB if you did the edits they are perfect. i sometimes forget that we're expected to write in a technical report-like fashion which i have years of experience but im also a creative writer (i try to be at least) and a little bleeds in sometimes. Jun 6, 2022 at 17:13
• One idea is to use CloudEvaluate, e.g., SetOptions[Plot, CloudEvaluate[Options[Plot]]] Jun 6, 2022 at 17:41

buttonOptions =

In the example above, the options for button have been set according to the buttonOptions variable. AutoAction is active as well: in the animation, I am merely hovering over the button and a new action is taken each time.
• yes i do that too. however i always output a Sequence object and use args for opts or styles if they differ Jun 9, 2022 at 14:05