10.2.1 Outline Editing

All of the various outline editing interfaces on the Emacs desktop allow the user to hide or show the contents at the different levels of a possibly nested tree structure. Components of this tree structure can be manipulated as a unit, e.g., entire subtrees can be deleted or copied. Outline editing thus provides an efficient means of obtaining quick overviews of a document.

The visual interface displays such hidden content as a series of ellipses following the visible outline heading. Emacspeak produces auditory icon ellipses when speaking such outline headings.

The basic outline mode allows the user to specify the syntax and level of outline header lines as a regular expression. This simple technique can be used to advantage in the structured navigation of large electronic texts such as those available on the Internet from online book projects such as project Gutenberg and the Internet Wiretap. For example, when this feature is activated while reading the electronic text of a Shakespearean play, the different acts can be recognized as separate nodes in the logical structure of the document. The user can then hide the document body with a single keystroke, navigate the outline headings to find a particular act, and have that portion rendered either visually or aurally. Hiding an outline level produces auditory icon close-object; exposing a hidden level produces auditory icon open-object. For details on using mode outline, see the relevant section of the online Emacs info manual.

The basic outline facility described above is applicable to all content being edited or browsed on the Emacspeak desktop. In addition, Emacspeak has other specialized outline editing modes such as folding mode that provide extended outlining facilities. In mode folding, the user can create (possibly nested) folds — logical containers of content that are delimited by a special fold mark. The fold mark is typically a text string that is chosen based on the type of content that is being manipulated. Thus, when folding a C~program source file, fold marks are created from C~comments. The user can open or close any or all folds in a document, and these actions are accompanied by auditory icons open-object and close-object. By entering a fold, all editing actions are restricted to the contents of that fold; this proves a simple yet convenient way of constraining editing actions such as search and replace to specific portions of large documents. Folds can be manipulated as a unit and can be deleted, copied or moved.

Mode folding proves especially effective in maintaining large software modules. The technique can be used to advantage by creating folds for different sections in a module and by further placing each function appearing in a particular section in a fold of its own. Complex functions can themselves be folded into sections where each section reflects a different stage in the algorithm implemented by that function. Thus, the technique of folding can be used as an effective aid in literate programming. I typically write software modules by first creating an outline structure using folds that reflect the various components of that module. Next, I populate each fold with the function signatures and documentation for the functions in each section. When I am satisfied with the overall architecture of the module, I fill in the function skeletons with actual program code. This technique is used extensively in maintaining the Emacspeak code base.