Emacs: What is Major Mode

By Xah Lee. Date: . Last updated: .

What is a Major Mode

Each buffer/file is associated with one major mode.

A “major mode” is a collection of emacs behaviors, designed for specific task.

Example of major modes:

Switch to a Major Mode

Each major mode typically has a associated command. Just call the command. For example, Alt+x shell.

Typically, if a mode is named “xyz-mode”, the command to turn it on is named “xyz” or “xyz-mode”.

To turn “off” a major mode, just switch to another major mode. There's always one major mode on.


The most basic major mode is fundamental-mode.

So, in a sense if you want to “turn off” all major modes, just Alt+x fundamental-mode.

How to Get a List of Major Modes

Alt+x apropos-command, then type “-mode”. (it's not a complete list, because some major mode's name does not end in “mode”)

Or, Alt+x describe-variable, then type auto-mode-alist. It'll list major modes associated with file name extension.

[see Emacs: Set Default Major Mode]

Find Current Major Mode Name

Emacs: Find Major Mode Name

Set Default Major Mode

Emacs: Set Default Major Mode

Major Mode and Minor Mode

If you have a question, put $5 at patreon and message me on xah discord.
Or support me by Buy Xah Emacs Tutorial

Emacs Tutorial

Emacs Init

Emacs Keys


ELisp Examples

ELisp Write Major Mode

Emacs Init

Init Basics


text editing