GNU Emacs can edit a variety of different types of text and adapts its behavior by entering add-on modes called "major modes." Defined major modes exist for many different file types including ordinary text files, the source code of many programming languages, HTML documents, and TeX and LaTeX documents. Each major mode involves an Emacs Lisp program that extends the editor to behave more conveniently for the specified type of text.
Major modes typically provide some or all of the following common features:
- Syntax highlighting ("font lock"): combinations of fonts and colors, termed "faces," that differentiate between document elements such as keywords and comments.
- Automatic indentation to maintain consistent formatting within a file.
- The automatic insertion of elements required by the structure of the document, such as spaces, newlines, and parentheses.
- Special editing commands, such as commands to jump to the beginning or the end of a function while editing a programming file or commands to validate documents or insert closing tags while working with markup languages such as XML.