Apart from Fundamental mode, there are three major modes that other major modes commonly derive from: Text mode, Prog mode, and Special mode. While Text mode is useful in its own right (e.g., for editing files ending in .txt), Prog mode and Special mode exist mainly to let other modes derive from them.
As far as possible, new major modes should be derived, either directly
or indirectly, from one of these three modes. One reason is that this
allows users to customize a single mode hook
prog-mode-hook) for an entire family of relevant modes
(e.g., all programming language modes).
Text mode is a major mode for editing human languages. It defines the ‘"’ and ‘\’ characters as having punctuation syntax (see Syntax Class Table), and binds M-<TAB> to
An example of a major mode derived from Text mode is HTML mode. See SGML and HTML Modes.
Prog mode is a basic major mode for buffers containing programming language source code. Most of the programming language major modes built into Emacs are derived from it.
Special mode is a basic major mode for buffers containing text that is produced specially by Emacs, rather than directly from a file. Major modes derived from Special mode are given a
special(see Major Mode Conventions).
Special mode sets the buffer to read-only. Its keymap defines several common bindings, including q for
quit-windowand g for
An example of a major mode derived from Special mode is Buffer Menu mode, which is used by the *Buffer List* buffer. See Listing Existing Buffers.
In addition, modes for buffers of tabulated data can inherit from Tabulated List mode, which is in turn derived from Special mode. See Tabulated List Mode.