elisp: Basic Major Modes
22.2.5 Basic Major Modes
------------------------
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 (e.g.,
‘prog-mode-hook’) for an entire family of relevant modes (e.g., all
programming language modes).
-- Command: text-mode
Text mode is a major mode for editing human languages. It defines
the ‘"’ and ‘\’ characters as having punctuation syntax (
Syntax Class Table), and binds ‘M-<TAB>’ to
‘ispell-complete-word’ ((emacs)Spelling).
An example of a major mode derived from Text mode is HTML mode.
SGML and HTML Modes (emacs)HTML Mode.
-- Command: prog-mode
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.
via Parsing::) and ‘bidi-paragraph-direction’ to ‘left-to-right’
(Bidirectional Display).
-- Command: special-mode
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 ‘mode-class’
property of ‘special’ (Major Mode Conventions).
Special mode sets the buffer to read-only. Its keymap defines
several common bindings, including ‘q’ for ‘quit-window’ and ‘g’
for ‘revert-buffer’ (Reverting).
An example of a major mode derived from Special mode is Buffer Menu
mode, which is used by the ‘*Buffer List*’ buffer. Listing
Existing Buffers (emacs)List Buffers.
In addition, modes for buffers of tabulated data can inherit from
Tabulated List mode, which is in turn derived from Special mode.
Tabulated List Mode.