0

evil-define-key's docs say it "create[s] a STATE binding from KEY to DEF for KEYMAP."

What is a "state"? What is a "state binding"? Emacs doesn't have "states" as far as I know?

My current understanding is that every keypress in Emacs does a lookup in the global key map, which is a literal mapping (like a dictionary in Python, or a "hash" in Ruby) from keys to either functions or another keymap. I know Evil has many different keymaps, one for each state. Isn't an Evil state just a keymap? If so, the description of evil-define-key almost makes sense; it creates a mapping from key to "DEF" in the relevant state keymap, but that only explains 3 out of the 4 parameters, so I must still be missing something. If my train of thought here is correct, then evil-define-key takes 2 keymaps: a state keymap and some other keymap. Why?

  • Sounds like it might be good to make a doc enhancement request to the Evil maintainers... (with or without info you might get from an answer here). – Drew Nov 14 '19 at 20:35
  • Please look at the evil page on emacswiki, and the manual available off of the evil GitHub repository. – Dan Nov 14 '19 at 22:09
  • States are documented in Evil's manual, I recommend reading it and rephrasing the question as needed. – wasamasa Nov 14 '19 at 22:59
  • I asked a more specific question at: emacs.stackexchange.com/questions/53774/… – Buttons840 Nov 15 '19 at 20:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.