Previous: , Up: Modes   [Contents][Index]


6.2 Minor Modes

The minor modes in Emacs provide some optional features which you can turn on or off. Any number of minor modes can be active at the same time with any major mode. You can enable a minor mode in one buffer and disable it in other mode. To enable a minor mode, for example the font-lock mode type the following command:

M-x font-lock-mode

To enable the other minor modes, replace the "font-lock" with the name of the minor mode. To disable the mode type the command again. A positive argument will always turn the mode on. Whenever you type this command, it will turn the mode on if it was off, OR it will turn it off if it was on i.e. it toggles. Look at the mode-line at the bottom of the frame. If it says FLock in parentheses, then it means that this mode is on, otherwise it is off.

The following are some of the minor modes available in SXEmacs. To enable any one of them type "M-x" in front of them.

font-lock-mode

You can also choose this mode by selecting the Syntax Highlighting menu item from the Options menu on the menu-bar at the top. If you wish to have this mode enabled permanently, choose Save Options from the Options menu. See Options Menu, for more information on the Options menu. You can also add statements in your init.el file. For each major mode in which you wish to enable this minor mode, you need a statement in your init.el file. The following example shows how to enable the font-lock mode when the major mode is c-mode.

(add-hook 'c-mode-hook          'turn-on-font-lock)

See Other Customizations.

When you enable this mode, the text will be displayed in different colors and fonts depending on the type of the text. This makes the text very easy to read and understand. For example, comments might be displayed in red, variables in black, functions in blue and other keywords in different colors and fonts. When you select More from the Syntax Highlighting option, you get very detailed display of colors and fonts; function names within comments themselves might appear in a different font and color.

auto-fill-mode

Enabling this mode will provide automatic word-wrapping. The SPC key will break lines i.e. insert newlines as you type to prevent lines from becoming too long.

overwrite-mode

When you enable this mode, the text that you type will replace the existing text rather than moving it to the right (the default case). You can enable this mode by selecting Overstrike menu-item from the Options menu from the menu-bar.

abbrev-mode

After you enable this mode, you can define words which will expand into some different text i.e. you can define abbreviations. For example, you might define "expand" to "expand will eventually expand to this text". After this definition you will be able to get "expand will eventually expand to this text" simply by typing

expand SPC

See Abbrevs in SXEmacs User’s Manual, for more information on this mode and on defining abbreviations.

auto-save-mode

After you enable this mode in a buffer, the contents of that buffer will be saved periodically. This will reduce the amount you might lose in case of a system crash.

line-number-mode

After you enable this mode, the line number at which your cursor is present will be displayed continuously in the mode line.

blink-paren

To enable this command, just type

M-x blink-paren

Do not add the "-mode" to it. You can also select the Paren Highlighting option from the Options menu. After you enable this command, put your cursor on one of the left parenthesis. The other matching parenthesis will start blinking. See Options Menu, for more information on the Paren Highlighting option.

For information on some other modes, look at the SXEmacs User’s Manual and the associated files.


Previous: , Up: Modes   [Contents][Index]