Miscellaneous

When a file is written there are two possible options concerning the folds. It can be written in such a way that at the next reading of the file stedi has some memory about which folds were closed, or this information can be omitted. The feature of this `memory' is called the autoclose feature. It is toggled with the command `set autoclose = on' or `set autoclose = off'. The value of autoclose can be stored in the default file with the DW command (p. [*]). The information of whether a fold was closed at the time of writing is stored as a trailing blank in the closing fold line, so no compiler should have any problems with it. Printing a file (P command) sends the file in the same representation as displayed on the screen: what you see is what you get.

Examples:

/* #[ multtwo:  Multiply an integer by two. */

int
multtwo(n)
int n;
{ 
	n = n * 2;
	return(n);
}

/* #[ multtwo:    */

This example puts a C language subroutine called 'multtwo' in a fold with the same name. Note that the freedom in the formatting of the beginning and ending fold lines is used to make the fold line commentary to the C compiler. If the fold were to be closed, it would look as follows:

/* ## multtwo:  Multiply an integer by two. */

The next example is for text files:

---#[ Fold1:

chapter 1   All about folds

--+#[ Fold1.1:   Introduction

Folds are wonderful.
They may revolutionize your life.

   #] Fold1.1:
--+#[ Fold1.2:   Commands

Folds with the command line, etc.

   #] Fold1.2:
%--+#[ Fold1.3:   Mouse
%
%Folds work with the mouse, too! And etc.
%
%   #] Fold1.3:

   #] Fold1:

In this example which simulates how a manual writer might organize his sections, there is one outer fold which contains three inner folds. The label of the fold has been used to provide outline numbering. If the command shift-F6 (close all) is issued, the above would look like:

---## Fold1:

Now if Fold1 is opened, the inner folds will remain closed and appear as follows:

---#[ Fold1:

chapter 1   All about folds

--+## Fold1.1:   Introduction
--+## Fold1.2:   Commands
%--+## Fold1.3:   Mouse

   #] Fold1:

For a further and more extensive example, the source code of the program 'keycomp.ttp' has been included. This program, which is responsible for compiling key redefinition files so that they can be read by the editor, is written in the C language. The program is fully commented and makes use of folds for organization. This program can be found in the directory called `SRC' on your original disk.