Assign keyboard map to derived mode in emacs

How to assign a key card for derived mode in emacs (I use the define-derived-mode function). There is a function derived-mode-set-keymap , but without examples or good documentation.

+6
emacs mode keymapping
source share
1 answer

define-derived-mode itself creates a layout called MODE-map, where MODE is the name of the newly defined keyboard layout. I'm not sure that derive-mode-set-keymap does not yet do this with define-derived-mode ; looking at the source, they do similar things, and I'm not sure about the differences at the lowest level between them (for example, define-derived-mode leaves the parent define-derived-mode key card as the parent of the new keyboard layout while the β€œdata set” is -keymap also combines keyboard layouts, and what is the functional difference between them?).

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

Then you can start manipulating any of them as you like.

+6
source share

All Articles