Emacs keybinding does not work in normal native mode

I am in the early stages of creating a core mode for Emacs to view and interact with the Stack Exchange Network.

It involves several basic modes: all with one key, similar to dired. I looked at the source diredand extracted what I thought would work:

(defvar stack-network-mode-map
  (let ((map (make-keymap)))
    (define-key map "n"     'stack-network-next-site)
    (define-key map "p"     'stack-network-previous-site)
    (define-key map ","     'stack-network-move-site-up)
    (define-key map "."     'stack-network-move-site-down)
    (define-key map "j"     'stack-network-jump-to-bookmarks)
    (define-key map "\C-m"  'stack-network-do-enter-site) ; ret
    (define-key map "o"     'stack-network-do-enter-site)
    (define-key map "u"     'stack-network-do-profile-summary)
    (define-key map "\C-uu" 'stack-network-do-profile-summary-for-user)
    (define-key map "i"     'stack-network-do-inbox)
    (define-key map "b"     'stack-network-toggle-bookmark)
    (define-key map "?"     'stack-network-list-functions) ; [1]
    (define-key map "\C-i"  'stack-network-display-details) ; tab
    map)
  "Keymap for Stack Exchange: Network Browser major mode")

but unfortunately this does not seem to have any effect; the buffer is simply edited just like any other regular buffer. How can I achieve single-key keys if this is not the case? (Which, by the way, I'm sure it is. There must be something else.)

+5
source share
3 answers

stack-network-mode define-derived-mode ( , , special-mode).

:

  • () nil .
  • stack-network-next-site (interactive) docstring, , .

special-mode, supress-keymap make-keymap.

+5

stack-network-mode-map . define-derived-mode , defvar , nil, .

. :

variant -map. define-derived-mode keymap , -map .

+2

You have identified a key card, but you have not used it. The variable exists, but does not capture any key events.

(use-local-map stack-network-mode-map)
0
source

All Articles