Emacs: What is Major Mode
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:
- 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
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: