The same format handler is used for all text files. Specialization for a certain kind of text file (e.g., a Scheme file or C++ file) is provided through a mode. Different modes provide different key bindings and menus within the same basic editor frame.
A mode is implemented by a class derived from mred:basic-mode%. A mode object is attached to a mred:edit% buffer (see section ). Each buffer has only one mode, and each mode object is attached to only one buffer. A mode gets the first opportunity to handle input events from the user, and it is notified about all changes to the buffer. The mode for a buffer can be changed by the user at any time. In mred:frame%, a mode is automatically selected for a new buffer based on the buffer's filename.
A new mode handler is installed with
(mred:insert-mode-handler name ext handler)
The name argument is a string that names the mode handler; e.g.
``Scheme'' or ``C++''. The ext argument specifies when the
handler should be invoked. It can be either:
(mred:find-mode-handler filename)
returns the mode handler procedure for
filename or #f if no handler is found.
(mred:find-named-mode-handler name)
returns the mode handler with the name name
(a mode name, not a filename) or #f is no mode by that name
exists.