ARCHIVED: In Emacs, how do I switch modes?

This content has been archived, and is no longer maintained by Indiana University. Information here may no longer be accurate, and links may no longer be available or reliable.

To change a buffer's mode while using Emacs, enter:

  M-x mode-name

M-x indicates pressing the Meta key (if you have one) and x. If you don't have a Meta key, press and release the Esc key, and then press x. Replace mode-name with the name of the mode to which you want to switch. For more information about keystrokes in Emacs, see How keystrokes are denoted in Emacs

What follows is a list of some of the major modes and their functions. The phrases in the "Mode-name" column can be used with the command above to switch modes.

Mode-name Function
asm-mode Assembly code
awk-mode awk code
c++-mode C++ code
c-mode C code
fortran-mode Fortran code
fundamental-mode Default mode
latex-mode LaTeX files
lisp-mode
Lisp code (other than Emacs Lisp)
pascal-mode Pascal code
perl-mode Perl code
scheme-mode Scheme code
sgml-mode SGML code
tex-mode TeX files
text-mode Regular text

Note that these are all major modes. A file in a buffer can only be in one major mode at a time. There are also numerous minor modes, such as overwrite-mode (for overwriting instead of inserting text), and auto-fill-mode (for automatically wrapping text as you write it). A buffer may have multiple minor modes. To get a list of the all the available modes, both major and minor, on your system's version of Emacs, look up "mode" using Emacs' apropos command. Do this by pressing C-h a and entering the word mode.

If you wish to set up Emacs to automatically enter a certain mode when opening a certain file type, see ARCHIVED: In Emacs, how can I make the program start in a given mode?

At Indiana University, for personal or departmental Linux or Unix systems support, see Get help for Linux or Unix at IU.

Related documents

This is document acyg in the Knowledge Base.
Last modified on 2018-01-18 10:47:12.