www.delorie.com/gnu/docs/elisp-manual-21/elisp_354.html   search  
Buy the book!

GNU Emacs Lisp Reference Manual

[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

23.2 Minor Modes

A minor mode provides features that users may enable or disable independently of the choice of major mode. Minor modes can be enabled individually or in combination. Minor modes would be better named "generally available, optional feature modes," except that such a name would be unwieldy.

A minor mode is not usually meant as a variation of a single major mode. Usually they are general and can apply to many major modes. For example, Auto Fill mode works with any major mode that permits text insertion. To be general, a minor mode must be effectively independent of the things major modes do.

A minor mode is often much more difficult to implement than a major mode. One reason is that you should be able to activate and deactivate minor modes in any order. A minor mode should be able to have its desired effect regardless of the major mode and regardless of the other minor modes in effect.

Often the biggest problem in implementing a minor mode is finding a way to insert the necessary hook into the rest of Emacs. Minor mode keymaps make this easier than it used to be.

23.2.1 Conventions for Writing Minor Modes  Tips for writing a minor mode.
23.2.2 Keymaps and Minor Modes  How a minor mode can have its own keymap.
23.2.3 Defining Minor Modes  A convenient facility for defining minor modes.

  webmaster     delorie software   privacy  
  Copyright 2003   by The Free Software Foundation     Updated Jun 2003