Harmonia
 Harmonia-Mode User's Guide Printer-Friendly Version  

Indentation and Highlighting

This section describes Harmonia-Mode's automatic indentation and highlighting systems.

Indentation

Harmonia-Mode can automatically indent the lines of your source code. Harmonia-Mode supports proper (Emacs-style) indentation. If you press tab on a particular line, no matter where on that line, it will indent the line to its proper location, given its context. (By constrast, improper indentation is what you get from a word processor. When you press tab, it inserts a tab at your cursor location no matter what context you are in. While fine for writing poetry, this is not so useful for writing programs.)

Harmonia-Mode's indentation system behaves similarly to XEmacs' system (or at least, we tried to make it behave that way), but is implemented completely differently. Instead of XEmacs' reliance on inexact textual heuristics, we use the tokenization and syntactic structure that Harmonia maintains for each document to provide precise, correct, information to the incremental indentation engine. This engine is programming language-independent; for each programming language that Harmonia-Mode supports, there is a corresponding XML-based indentation specification file (installed in /usr/harmonia/etc) that describes how to indent a particular line in a variety of contexts.

All of XEmacs' indentation commands, such as indent-region, are overridden with Harmonia-Mode's indentation algorithm as well. In this first release of Harmonia-Mode, we have not given you enough documentation to write your own indentation specifications, but feel free to take a look and tinker with it.

Syntax Highlighting

Harmonia-Mode supports syntax highlighting. The decision of what to highlight is undertaken by our own language-specific highlighting specification. Again, instead of relying on XEmacs' reliance on on inexact textual heuristics (regular expressions), Harmonia-Mode uses our precise tokenization and syntactic (where appropriate) information to color tokens. Each programming language's specification is written in a Lisp-like notation (though for this release, is uncustomizable by the user.)

Harmonia-mode uses more faces than font-lock does, each of which may be customized to your liking.

Error and Warning Display

When one of Harmonia-Mode's analyses discover an error in the program (something that a compiler would catch), it informs the programmer by underlining the invalid region and pointing at it with a triangle in the left margin. Compiler warnings are indicated in a different color and marked by an exclamation mark icon.

Moving the mouse cursor or text cursor over the error region causes an explanation of the error to appear at the bottom of the XEmacs window.

As soon as the programmer fixes the error or warning, the underline will disappear from view.

See the customization section for information on changing the way errors and warnings are displayed.

Next Section: Structural Movement