SetOptions[s,name1value1,name2value2,…]
sets the specified default options for a symbol s.
Details
- SetOptions is equivalent to an assignment that redefines certain elements of the list Options[s] of default options.
- SetOptions can be used on Protected symbols that do not also have the Locked attribute.
- SetOptions returns the new form of Options[s].
- You can use SetOptions on InputStream and OutputStream objects. If there is only one stream with a particular name, you can give the name as a string as the argument of Options.
- SetOptions can be used on a list of streams, such as the value of $Output.
- If object refers to a front end object such as $FrontEnd, NotebookObject, or CellObject, the kernel will send a request to the front end that will immediately make the change specified.
Examples
open allclose allScope (4)
Reset the default precision for HilbertMatrix:
Now HilbertMatrix uses machine numbers by default:
A specific option setting overrides the new default:
Start writing to a temporary file:
Set the page width to 10 characters:
Write Range[10] to the file and close the stream:
Line breaks occur at the 10th column:
Create a reference to the input cell:
Change the background of the cell to red:
Restore the the setting of the cell, which will cause it to inherit from the notebook:
Change the Permissions of a CloudObject:
Properties & Relations (2)
SetOptions can be used to modify protected symbols:
The symbol still has attribute Protected:
SetOptions resets the Permissions value entirely (except for the owner's permissions):
SetPermissions only resets the capabilities of the given user groups:
Possible Issues (2)
SetOptions can only be used the change the default value of an option, not to add a new one:
Use AppendTo, PrependTo and similar functions to add additional options to a function:
For notebook options with rules, it can be awkward to make a targeted change to a specific rule:
CurrentValue provides a better way of adding or changing specific rules:
Related Guides
-
▪
- Low-Level Notebook Programming ▪
- Options Management ▪
- Session Customization ▪
- Programmatic Notebook & Interface Customization ▪
- Sharing & Embedding Content ▪
- Creating Form Interfaces & Apps ▪
- Creating Instant APIs ▪
- Low-Level System Optimization ▪
- Wolfram System Setup ▪
- Package Development ▪
- Palettes ▪
- Persistent Storage ▪
- Toolbars ▪
- Cloud Permissions Control ▪
- Wolfram Data Repository ▪
- Wolfram Resource System ▪
- Structured Data in the Cloud