Next: Mode Hooks, Previous: Derived Modes, Up: Major Modes [Contents][Index]

#### 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 (see Syntax Class Table), and binds `M-TAB` to `ispell-complete-word` (see Spelling in The GNU Emacs Manual).

  An example of a major mode derived from Text mode is HTML mode. See SGML and HTML Modes in The GNU Emacs Manual.

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.

  Prog mode binds `parse-sexp-ignore-comments` to `t` (see Motion via Parsing) and `bidi-paragraph-direction` to `left-to-right` (see 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` (see 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` (see Reverting).

  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 The GNU Emacs Manual.

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.

Next: Mode Hooks, Previous: Derived Modes, Up: Major Modes [Contents][Index]