In Emacs, how do I switch modes?

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 In Emacs, how are keystrokes denoted?

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 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 At IU, how do I get support for Linux or Unix?

This is document acyg in the Knowledge Base.
Last modified on 2011-02-16.

  • Fill out this form to submit your issue to the UITS Support Center.
  • Please note that you must be affiliated with Indiana University to receive support.
  • All fields are required.

Please provide your IU email address. If you currently have a problem receiving email at your IU account, enter an alternate email address.

  • Fill out this form to submit your comment to the IU Knowledge Base.
  • If you are affiliated with Indiana University and need help with a computing problem, please use the I need help with a computing problem section above, or contact your campus Support Center.

Please provide your IU email address. If you currently have a problem receiving email at your IU account, enter an alternate email address.