How can I assign a keymap to a derived mode in emacs (I am using the define-derived-mode function). There is a derived-mode-set-keymap function but without examples or good documentation.
How can I assign a keymap to a derived mode in emacs (I am
Share
define-derived-modeitself creates a keymap with the name MODE-map, where MODE is the name of the keymap you’ve just defined. I’m not sure whatderive-mode-set-keymapdoes that is not already done withdefine-derived-mode; looking at the source, they do similar things, and I’m unsure of the very low-level differences between the two (e.g.define-derived-modeleaves the parent-mode’s keymap as the parent of the new keymap while `derive-mode-set-keymap also merges the keymaps; what’s the functional difference between the two?).If you do the following:
Then the following variables will be defined:
foobar-mode-abbrev-tablefoobar-mode-hookfoobar-mode-mapfoobar-mode-syntax-tableYou can then start manipulating any of these as you like.