Emacs: What is Major Mode

By Xah Lee. Date: . Last updated: .

What is a Major Mode

Each buffer is associated with one major mode.

A major mode is a collection of emacs features, designed for specific task.

Example of major modes:

Switch to a Major Mode

Each major mode typically has a associated command. e.g. Alt+x shell. If a mode is named “xx-mode”, the command to turn it on is usually named “xx” or “xx-mode”.

A proper major mode is usually automatically turned on when you open a file. [see Emacs Init: Set Default Major Mode]

What is fundamental-mode

fundamental-mode is the most basic major mode.

If you want to turn off major mode, switch to fundamental-mode.

Find the Name of Current Major-Mode

The current major mode's name is stored in a variable major-mode

major-mode
A Buffer Local Variable . Value is Symbol of current buffer's major mode. [see Emacs: Show Variable Value]

Major Mode's Display Name

Current major mode's display name shows in the mode line:

emacs major mode mode line 2022-05-15 Gxv4
major mode display name in mode line 2022-05-15

Major Mode, Minor Mode, Minibuffer, Hook