So far we have explained the ins and outs of the global map. Major modes customize Emacs by providing their own key bindings in local keymaps . For example, C mode overrides TAB to make it indent the current line for C code. Portions of text in the buffer can specify their own keymaps to substitute for the keymap of the buffer's major mode.
Minor modes can also have local keymaps.
Whenever a minor mode is in effect, the definitions in its keymap override both the major mode's local keymap and the global keymap. The local keymaps for Lisp mode and several other major modes always exist even when not in use. For major modes less often used, the local keymap is normally constructed only when the mode is used for the first time in a session. This is to save space. All minor mode keymaps are created in advance.