Next: , Previous: , Up: Basics   [Contents][Index]


2.5 Basic Preferences

ne has a number of flags that specify alternative behaviors, the most prototypical example being the insert flag, which specifies whether the text you type is inserted into the existing text or replaces it. You can toggle this flag with the ‘Insert’ menu item of the ‘Prefs’ menu, or with the Insert key of your keyboard. (Toggle means to change the value of a flag from true to false, or from false to true; see Insert.)

Another important flag is the free form flag, which specifies whether the cursor can be moved beyond the right end of each line of text or only to existing text (a la vi). Programmers usually prefer non free form editing; text writers seem to prefer free form. See FreeForm for some elaboration. The free form flag can be set with the ‘Free Form’ menu item of the ‘Prefs’ menu.

At this point, we suggest you explore by trial and error the other flags of the ‘Prefs’ menu, or try the Flags command (see Flags), which explains all the flags and the commands that operate on them. We prefer spending a few words discussing automatic preferences or autoprefs, and default preferences or defprefs.

Having many flags ensures a high degree of flexibility, but it can turn editing into a nightmare if you have to turn on and off dozens of flags for each different kind of file you edit. ne’s solution is to load your default preferences whenever ne is run before loading any file, then additionally set your stated preferences automatically for each file type as files are loaded. A file’s type is determined by the extension of its file name, that is, the last group of letters after the last dot. For instance, the extension of ne.texinfo is ‘texinfo’, the extension of source.c is ‘c’, and the extension of my.txt is ‘txt’.

Thus, when you select the ‘Save Def Prefs’ menu item or the SaveDefPrefs command, a special preferences file named .default#ap is saved. In addition to other preferences, this file also includes a small set of preferences which are global to ne rather than specific to particular document types. These preferences are: FastGUI, RequestOrder, StatusBar and VerboseMacros; see FastGUI, See RequestOrder, See StatusBar, and See VerboseMacros. These extra preferences are not saved by the SaveAutoPrefs command.

By contrast, whenever you select the ‘Save AutoPrefs’ menu item, ne saves the flags of your current document to be used when you load other files with the same extension. These autoprefs are saved in a file in your ~/.ne directory. This file has the same name as the extension of the current document with ‘#ap’ appended to it. It contains all the commands necessary to recreate your current document’s flag settings. Whenever you open a file with this file name extension, ne will automagically recreate your preferred flag settings for that file type. (There is a flag that inhibits the process; see AutoPrefs.)

Similar to preference flags, the current syntax definition is specific to the current document type, so it also is saved in autoprefs files by the SaveAutoPrefs command or ‘Save AutoPrefs’ menu; it is not saved in the .default#ap file.

Note that a preferences file—whether .default#ap or an AutoPrefs file— is just a macro (as described in the following section). Thus, it can be edited manually if necessary.

Some files have no extension, but the file type can be discerned by simple examination. Consider for example a file named example which contains XML. You may reasonably expect it to be treated as an .xml file rather than a generic file. For the purposes of applying automatic preferences and syntax definitions, ne provides a mechanism for overriding a wrong or missing extension with a virtual extension based on a document’s contents. You do this by creating a ~/.ne/.extensions file which is fully described in the Virtual Extensions section.


Next: , Previous: , Up: Basics   [Contents][Index]