GNU Emacs Manual - Minor Modes

Go to the first, previous, next, last section, table of contents.

## Minor Modes

Minor modes are optional features which you can turn on or off. For example, Auto Fill mode is a minor mode in which `SPC` breaks lines between words as you type. All the minor modes are independent of each other and of the selected major mode. Most minor modes say in the mode line when they are on; for example, ``Fill'` in the mode line means that Auto Fill mode is on.

Append `-mode` to the name of a minor mode to get the name of a command function that turns the mode on or off. Thus, the command to enable or disable Auto Fill mode is called `M-x auto-fill-mode`. These commands are usually invoked with `M-x`, but you can bind keys to them if you wish. With no argument, the function turns the mode on if it was off and off if it was on. This is known as toggling. A positive argument always turns the mode on, and an explicit zero argument or a negative argument always turns it off.

Enabling or disabling some minor modes applies only to the current buffer; each buffer is independent of the other buffers. Therefore, you can enable the mode in particular buffers and disable it in others. The per-buffer minor modes include Abbrev mode, Auto Fill mode, Auto Save mode, Font-Lock mode, Hscroll mode, ISO Accents mode, Outline minor mode, Overwrite mode, and Binary Overwrite mode.

Abbrev mode allows you to define abbreviations that automatically expand as you type them. For example, ``amd'` might expand to ``abbrev mode'`. See section Abbrevs, for full information.

Auto Fill mode allows you to enter filled text without breaking lines explicitly. Emacs inserts newlines as necessary to prevent lines from becoming too long. See section Filling Text.

Auto Save mode causes the contents of a buffer to be saved periodically to reduce the amount of work you can lose in case of a system crash. See section Auto-Saving: Protection Against Disasters.

Enriched mode enables editing and saving of formatted text. See section Editing Formatted Text.

Flyspell mode automatically highlights misspelled words. See section Checking and Correcting Spelling.

Font-Lock mode automatically highlights certain textual units found in programs, such as comments, strings, and function names being defined. This requires a window system that can display multiple fonts. See section Using Multiple Typefaces.

Hscroll mode performs horizontal scrolling automatically to keep point on the screen. See section Horizontal Scrolling.

ISO Accents mode makes the characters ```'`, ``''`, ``"'`, ``^'`, ``/'` and ``~'` combine with the following letter, to produce an accented letter in the ISO Latin-1 character set. See section Single-byte European Character Support.

Outline minor mode provides the same facilities as the major mode called Outline mode; but since it is a minor mode instead, you can combine it with any major mode. See section Outline Mode.

Overwrite mode causes ordinary printing characters to replace existing text instead of shoving it to the right. For example, if point is in front of the ``B'` in ``FOOBAR'`, then in Overwrite mode typing a `G` changes it to ``FOOGAR'`, instead of producing ``FOOGBAR'` as usual. In Overwrite mode, the command `C-q` inserts the next character whatever it may be, even if it is a digit--this gives you a way to insert a character instead of replacing an existing character.

Binary Overwrite mode is a variant of Overwrite mode for editing binary files; it treats newlines and tabs like other characters, so that they overwrite other characters and can be overwritten by them.

The following minor modes normally apply to all buffers at once. Since each is enabled or disabled by the value of a variable, you can set them differently for particular buffers, by explicitly making the corresponding variables local in those buffers. See section Local Variables.

Icomplete mode displays an indication of available completions when you are in the minibuffer and completion is active. See section Completion Options.

Line Number mode enables continuous display in the mode line of the line number of point. See section The Mode Line.

Resize-Minibuffer mode makes the minibuffer expand as necessary to hold the text that you put in it. See section Editing in the Minibuffer.

Scroll Bar mode gives each window a scroll bar (see section Scroll Bars). Menu Bar mode gives each frame a menu bar (see section Menu Bars). Both of these modes are enabled by default when you use the X Window System.

In Transient Mark mode, every change in the buffer contents "deactivates" the mark, so that commands that operate on the region will get an error. This means you must either set the mark, or explicitly "reactivate" it, before each command that uses the region. The advantage of Transient Mark mode is that Emacs can display the region highlighted (currently only when using X). See section Setting the Mark.

For most minor modes, the command name is also the name of a variable which directly controls the mode. The mode is enabled whenever this variable's value is non-`nil`, and the minor-mode command works by setting the variable. For example, the command `outline-minor-mode` works by setting the value of `outline-minor-mode` as a variable; it is this variable that directly turns Outline minor mode on and off. To check whether a given minor mode works this way, use `C-h v` to ask for documentation on the variable name.

These minor-mode variables provide a good way for Lisp programs to turn minor modes on and off; they are also useful in a file's local variables list. But please think twice before setting minor modes with a local variables list, because most minor modes are matter of user preference--other users editing the same file might not want the same minor modes you prefer.

Go to the first, previous, next, last section, table of contents.