Next: , Up: Modes   [Index]


10.1 Major Modes

Every buffer possesses a major mode, which determines the editing behavior of Emacs while that buffer is current. The mode line normally shows the name of the current major mode, in parentheses

Fundamental Mode

Least specialized major mode. This mode has no mode-specific redefinitions or variable settings, so that each Emacs command behaves in its most general manner, and each user option variable is in its default state.

For editing text of a specific type that Emacs knows about, such as Lisp code or English text, you typically use a more specialized major mode, such as Lisp mode or Text mode. Most major modes fall into three major groups.

  1. modes for normal text
    • Text mode,
    • HTML mode,
    • SGML mode,
    • TeX mode and
    • Outline mode
  1. modes for specific programming languages
    • Lisp’ mode (which has several variants),
    • C’ mode,
    • Fortran’ mode,
    • and others
  1. are not associated directly with files; they are used in buffers created for specific purposes by Emacs
    • Dired’ mode for buffers made by Dired (see Dired),
    • Message’ mode for buffers made by ‘C-x m’ (see Sending Mail), and
    • Shell’ mode for buffers used to communicate with an inferior shell process

Selecting a Major Mode

Usually, the major mode is automatically set by Emacs, when you first visit a file or create a buffer (see Choosing Modes). You can explicitly select a new major mode by using an M-x command. Take the name of the mode and add ‘-mode’ to get the name of the command to select that mode (e.g., ‘M-x lisp-mode’ enters ‘Lisp’ mode). Since every buffer has exactly one major mode, there is no way to “turn off” a major mode; instead you must switch to a different one.


Next: Minor Modes, Up: Modes   [Index]