The Emacs way of doing this is to offer major and minor editing modes for differentfiles and programs.
MajorModes
Exactlyone majormode is enabled at a time for a given buffer. That is, the major mode is localfor each buffer, and every buffer is always in a given major mode. The majormode might contain different configurations. Most of them include the following:
-
Specialized keybindings-- Many major modes redefine the meanings of the Tab and Return keys, but other keys can also be redefined. To get a list of keybindings for the major mode, press C-h m (describe-mode) when it is enabled.
-
Specialized functions-- These are often available with C-c as a prefix (that is, type C-c and another key to get to the function). To see which bindings exists for the C-c prefix, press C-c C-h.
-
Adding functions to menus-- Some major modes create a menu entry for the major mode functions.
-
Configuration of variables-- Many different variables can be configured by the major mode. Examples of these include
Comment characters--These are used by functions that comment out a region, for example.
Outline regular expression--This is used by the outline library, which makes it possible to get an outline of the buffer.
Fontification descriptions--This is a set of variables that describe how a buffer can be colorized to make it a bit more readable.
MinorModes
Emacs has taken the customization grouping one step farther and developed a concept called minormodes. A minor mode is a set of customization options or functions that makes Emacs behave in a certain way. Any number of minor modes can be enabled at a time (this includes zero). Some minor modes are local to buffers, while others affect all of Emacs. The following list contains a few examples of some of the minor modes inEmacs:
-
font-lock-mode (local for a buffer)