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


1.5 Modes

A mode provides a way to change Hemlock’s behavior by specifying a modification to current key bindings, values of variables, and other things. Modes are typically used to adjust Hemlock to suit a particular editing task, e.g. Lisp mode is used for editing LISP code.

Modes in Hemlock are not like modes in most text editors; Hemlock is really a “modeless” editor. There are two ways that the Hemlock mode concept differs from the conventional one:

  1. Modes do not usually alter the environment in a very big way, i.e. replace the set of commands bound with another totally disjoint one. When a mode redefines what a key does, it is usually redefined to have a slightly different meaning, rather than a totally different one. For this reason, typing a given key does pretty much the same thing no matter what modes are in effect. This property is the distinguishing characteristic of a modeless editor.
  2. Once the modes appropriate for editing a given file have been chosen, they are seldom, if ever, changed. One of the advantages of modeless editors is that time is not wasted changing modes.

A major mode is used to make some big change in the editing environment. Language modes such as Pascal mode are major modes. A major mode is usually turned on by invoking the command mode-name Mode as an extended command. There is only one major mode present at a time. Turning on a major mode turns off the one that is currently in effect.

A minor mode is used to make a small change in the environment, such as automatically breaking lines if they get too long. Unlike major modes, any number of minor modes may be present at once. Ideally minor modes should do the “right thing” no matter what major and minor modes are in effect, but this is may not be the case when key bindings conflict.

Modes can be envisioned as switches, the major mode corresponding to one big switch which is thrown into the correct position for the type of editing being done, and each minor mode corresponding to an on-off switch which controls whether a certain characteristic is present.

Command: Fundamental Mode

This command puts the current buffer into Fundamental mode. Fundamental mode is the most basic major mode: it’s the next best thing to no mode at all.


Next: Display Conventions, Previous: The Prefix Argument, Up: Introduction   [Contents][Index]