### 3.9 Automatic Preferences

Automatic preferences let you set up a custom configuration that is automatically used whenever you open a file with a given extension. For instance, you may prefer a tab size of three when editing C sources, but eight could be more palatable when writing electronic mail.

The use of autoprefs is definitely straightforward. You simply use the ‘`Save AutoPrefs`’ menu item (or the `SaveAutoPrefs` command; see SaveAutoPrefs) when the current document has the given extension and the current configuration suits your tastes. The internal state of a series of options will be recorded as a macro containing commands that reproduce the current configuration. The macro is then saved in the `~/.ne` directory (which is created if necessary) with the name given by the extension, postfixed with ‘`#ap`’. Thus, the C sources automatic preferences file will be named ‘`c#ap`’, the one for TeX files ‘`tex#ap`’, and so on.

Macros are generated with short or long command names depending on the status of the verbose macros flag. See VerboseMacros.

Automatic preferences files are loaded and executed whenever a file with a known extension is opened. Note that you can manually edit such files, and even insert commands, but any command that does something other than setting a flag will be rejected, and an error message will be issued.