noctuid / general.el

More convenient key definitions in emacs
GNU General Public License v3.0
1k stars 44 forks source link

general-def does not work with general-chords #137

Open gpanders opened 6 years ago

gpanders commented 6 years ago

According to the documentation, these two commands should be equivalent:

(general-define-key
 :keymaps 'evil-insert-state-map
 (general-chord "jk") 'evil-normal-state)
(general-def evil-insert-state-map
  (general-chord "jk") 'evil-normal-state)

However, only the first one works (the second does not show anything in general-describe-keybindings). Why the discrepancy?

noctuid commented 6 years ago

general-def accepts 'evil-state (keymap1 keymap2 ...) as a possibility, so it's assuming that you're specifying a list of keymaps. See the very last paragraph in the section that you linked to, which explains this in further detail. You can either add a bogus keyword/value pair like :start-maps t to separate the positional arguments from the bindings or replace general-def with general-emacs-define-key (which you can alias to something shorter if you want).

This disclaimer should probably be in its own section and linked to in the key features section. I'll leave this issue open until the documentation is improved.