I've run into a few situations where it would be highly convenient to have to have the keymap of one major-mode act as a fallback keymap for another major-mode. For instance:
- I write a lot of LaTeX in some of my org documents, so it would be
great to have
latex-mode
commands easily available while editingorg-mode
. - I frequent an irc room with Markdown support, so it would also be
nice to have
markdown-mode
keybinds added toerc-mode
.
In both cases this extra keymap should act as a fallback (this why
I can't just use a minor mode for this). I don't want latex commands
to override any org-mode
keys. What I want is:
If a key is defined in latex-mode-map
AND it is not defined in
org-mode-map
then use the latex-mode-map
binding.
Q: How can I set a keymap as a fallback keymap for a major-mode?
OR
Q: How can copy keys from one major-mode-map to another, without overriding anything?
Just to be clear. I know I could define these keys one by one, but it would be infinitely more convenient to have an automated solution.
make-composed-keymap
.