Emacs: What is Major Mode
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:
- programing languages:
emacs-lisp-mode
,python-mode
,ruby-mode
,js-mode
etc. dired
[see Emacs: File Manager, dired]shell
[see Emacs: Run Shell in Emacs]image-mode
[see Emacs: View Image File]eww
[see Emacs: Eww Web Browser]
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”.
- To switch to a major mode, just Alt+x major_mode_command_name
- To turn “off” a major mode, just switch to another major mode. There's always one major mode on.
A proper major mode is usually automatically turned on when you open a file. [see Emacs: Set Default Major Mode]
fundamental-mode
The most basic major mode is fundamental-mode
. If you want to “turn off” all major modes, type Alt+x fundamental-mode
.
What is current major-mode
Current major mode's nick name shows in the mode line:

The current major mode's actual emacs lisp symbol is stored in a variable major-mode . This is more useful for emacs init and coding.
- major-mode
- A Buffer Local Variable . Value is Symbol for current buffer's major mode. [see Emacs: Show Variable Value, List Variables]