noctuid/general.el

Error defining keys

Closed this issue · 1 comments

Sorry for the generic topic title, I have no idea why this specific binding is causing an error for me. Here is my call to general:

(general-define-key
 :states '(normal evilified motion)
 "s-h" #'evil-window-left
 "s-j" #'evil-window-down
 "s-k" #'evil-window-up
 "s-l" #'evil-window-right)

And here is the (truncated) stack trace:

Debugger entered--Lisp error: (wrong-type-argument keymapp nil)
  define-key(nil "\010" evil-window-left)
  evil-define-key*(evilified global "\010" evil-window-left)
  general--define-key-dispatch(evilified global ("\010" evil-window-left (:def evil-window-left) "\n" evil-window-down (:def evil-window-down) "\013" evil-window-up (:def evil-window-up) "\f" evil-window-right (:def evil-window-right)) (:wk-match-keys t :wk-match-binding t :wk-full-keys t :keymaps (global) :states (normal evilified motion) :states (normal evilified motion)))
  general--define-key((normal evilified motion) global ("\010" evil-window-left "\n" evil-window-down "\013" evil-window-up "\f" evil-window-right) nil nil (:wk-match-keys t :wk-match-binding t :wk-full-keys t :keymaps (global) :states (normal evilified motion) :states (normal evilified motion)))
  eval((general--define-key (quote (normal evilified motion)) (quote global) (quote ("\010" evil-window-left "\n" evil-window-down "\013" evil-window-up "\f" evil-window-right)) (quote nil) (quote nil) (quote (:wk-match-keys t :wk-match-binding t :wk-full-keys t :keymaps (global) :states (normal evilified motion) :states (normal evilified motion)))))
  general--delay((or (memq (quote global) (quote (local global))) (boundp (quote global))) (general--define-key (quote (normal evilified motion)) (quote global) (quote ("\010" evil-window-left "\n" evil-window-down "\013" evil-window-up "\f" evil-window-right)) (quote nil) (quote nil) (quote (:wk-match-keys t :wk-match-binding t :wk-full-keys t :keymaps (global) :states (normal evilified motion) :states (normal evilified motion)))) after-load-functions t nil "general-define-key-in-global439")
  general-define-key(:states (normal evilified motion) "C-h" evil-window-left "C-j" evil-window-down "C-k" evil-window-up "C-l" evil-window-right)
  (progn (general-define-key :states (quote (normal evilified motion)) "C-h" (function evil-window-left) "C-j" (function evil-window-down) "C-k" (function evil-window-up) "C-l" (function evil-window-right)))
  eval((progn (general-define-key :states (quote (normal evilified motion)) "C-h" (function evil-window-left) "C-j" (function evil-window-down) "C-k" (function evil-window-up) "C-l" (function evil-window-right))) t)

It looks like the issue is that evilified state does not yet exist. I've added a check to delay keybindings until states exist when using :keymaps 'global or :keymaps 'local. Please test.