Default settings

The editor contains a number of internal variables such as the screen color, the backup mode, the write mode, the search mode, tab settings, and so forth, as well as possibly such things as contents of learn buffers, macro's and keyboard redefinitions. In order to save all these settings for future use, stedi allows them to be written away to a file which can be read in at some later time. The file, called stedi.dft is also read automatically at startup if stedi can find it.

Actually the situation with the default settings is not quite so simple as explained above because of STEDI's ten text buffers. Certain settings are global, that is, they affect all buffers (for example, the color, learn buffers, and key redefinitions), but others can be set individually for each of the ten buffers. For example, the backup mode can be set differently for each file in one of the ten text buffers. These latter settings will be called local.

Stedi maintains a central defaults buffer which is filled at startup with the contents of stedi.dft or set by built in defaults if this file is not available. All global and local settings are kept in this buffer. Then each time a text buffer is opened, a copy of the local settings which are in the central buffer is copied to the text buffer to begin the editing in that buffer. After this, the user is free to change the settings as desired and the settings for each individual buffer will be remembered until the buffer is cleared, or until the end of the editing session. If a buffer is cleared, the settings will revert back to those in the central buffer.

Naturally for greatest flexibility, stedi requires a number of commands for input and output of these settings and for moving them around from one buffer to another if desired. These commands are the subject of this chapter. Below, the commands will be explained in a logical order, building up from the more basic operations. However it should be realized that the first commands mentioned are not necessarily the most used. In fact, one may get by, using only one or two of the commands explained in this chapter. However they are all included for completeness. All these commands are issued from the command line.

The first commands are for reading and writing from a file to the central buffer and vice versa. These commands are:

DI
This command reads the settings from the file called `stedi.dft' and places the contents in the central defaults buffer. This command should be remembered as `Defaults Import'.
DE
This command is used to write the contents of the central defaults buffer to a file called `stedi.dft'. If the file exists, it is overwritten. This command should be remembered as `Defaults Export'.

In order to copy the defaults which are stored in the central buffer into the default settings of one of the ten text buffers, the following commands are available.

DL
This command loads the settings for local variables from the central defaults buffer into the current buffer. This should be remembered as 'Defaults Load'.
DS
This command copies the local settings of the current buffer into the central defaults buffer. Consequently the settings for local variables present there are replaced. This should be remembered as 'Defaults Save'.

Of course if only the above commands were available, loading the settings of local variables into individual buffers could become quite laborious. Much more often one wants a combination of two of the above commands. Single commands accomplishing this are therefore available. These commands are:

DR
This command is a combination of the commands DI and DL above. This command thus reads in a default file called `stedi.dft' and fills the central defaults buffer with it. Then the settings for local variables are copied to the current buffer. It can be remembered as `Defaults Read'.

DW
This command is by far the most useful of all the commands described so far in this chapter. It is a combination of the DS and the DE commands. Thus it copies the local settings of the current buffer into the central defaults buffer, and then writes the entire contents of the central buffer out to a file called `stedi.dft'. This command is generally used when you have a set of current settings, both global and local, and you want to write them out to disk for a later editing session. The command can be remembered as 'Defaults Write'.

It is useful to be able to specify a default directory or folder (other than than the current one which is searched automatically) from which stedi can read the default file stedi.dft. The DD (Default Directory) command serves this purpose. The default directory is also used for writing out the defaults. The associated commands are:

DD pathname
This command sets a default path name to define a directory in which stedi will look for the default file stedi.dft, other than the current directory. This directory, called the `default directory', is used whenever stedi.dft is read or written, i.e. with the commands DI, DE, DR and DW. In the case of read operations, the editor first looks for the default file in the default directory, and then looks in the current directory. If the file is not found after this, an error message is issued. For write operations, stedi will try to write the default file in the currently set defaults directory first. If this directory is not found, the file will be written in the current directory. Finally the default directory can also be set at startup (see below).

DD

When the DD command is given without an argument, the name of the currently set default directory is reported on the message bar.

All commands mentioned so far in this chapter are case insensitive. Thus for the DW command, you may equally well type dw, dW or Dw.

During startup, you may pass a parameter to stedi to specify a default directory or a default file for reading the startup defaults. This is done by giving as a first parameter the characters -d or -D followed by one or more blanks and then a name. The name is interpreted as a path name and this will be the default directory. At the same time this directory will be searched when the help file is needed, or when a macro should be loaded from disk. After this come the file names to be edited separated by one or more blanks. For example suppose the startup defaults are in a directory called `BIN' on disk D and the file BIG.BUG in the current directory is desired to be edited. Then if starting from a shell, you would issue the command

    stedi -d d:\bin big.bug
The other way to specify the default directory during startup (and also the preferred one) is by setting the environment variable STEDIDFT. If this variable can be located during startup its contents are interpreted as the name of the default directory. A trailing directory separator isn't needed.

The order in which directories are searched for the default file is different at startup than during the DW command. At startup (p. [*]) first the current directory is searched, independent of a -d parameter or an environment parameter. If this isn't successful the path given by the -d option is tried. If the -d option hasn't been used the environment is tried.

Finally we close this chapter with a list of those settings which are stored in the default file.

The global variables which affect all text buffers are:

The local variables which can be changed locally for various text buffers are: