Major modes customize Emacs by providing their own key bindings in local keymaps.... Minor modes can also have local keymaps...
Roughly, it seems to say:
Major modes provide local keymaps. Minor modes have local keymaps.
I understand the idea of major and minor modes: A buffer has one major mode and possibly (usually) several minor modes which apply small modifications.
I am confused about the terminology "local keymap". For a time I thought "major" and "local" were somewhat synonymous. This was confusing because "major" implies big and important and "local" implies small and less important.
I then looked at the rules for looking up keybindings which are roughly:
(or (if overriding-terminal-local-map (find-in overriding-terminal-local-map)) (if overriding-local-map (find-in overriding-local-map) (or (find-in (get-char-property (point) 'keymap)) (find-in-any emulation-mode-map-alists) (find-in-any minor-mode-overriding-map-alist) (find-in-any minor-mode-map-alist) (if (get-text-property (point) 'local-map) (find-in (get-char-property (point) 'local-map)) (find-in (current-local-map))))) (find-in (current-global-map)))
It looks like minor mode keymaps are found in
minor-mode-overriding-map-alist, and that major mode keymaps are found in
current-local-map. All three of those are "local" variables, right? Which means any modifications to them are visible only to the current buffer. Do I understand that correctly?
If that is the case, then the keymaps do no belong to a major mode (or minor mode), they simply belong to buffer local variables.
Which brings me to my (somewhat vague) question: How are modes and keymaps associated?
To pick a specific example. How are
emacs-lisp-mode-map merely a template that initializes
current-local-map an independent copy? Or do all buffers using
emacs-lisp-mode share the same