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.
define-derived-mode
itself creates a keymap with the name MODE-map, where MODE is the name of the keymap you've just defined. I'm not sure what derive-mode-set-keymap
does that is not already done with define-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-mode
leaves 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:
(define-derived-mode foobar-mode text-mode "foo")
Then the following variables will be defined:
foobar-mode-abbrev-table
foobar-mode-hook
foobar-mode-map
foobar-mode-syntax-table
You can then start manipulating any of these as you like.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With