emacs-evil / evil-collection

A set of keybindings for evil-mode
GNU General Public License v3.0
1.21k stars 275 forks source link

evil-define-minor-mode-key not working in certain cases #834

Open julian-hoch opened 1 month ago

julian-hoch commented 1 month ago

Hi, I am trying to set up some keybindings for the minor mode 'vtable-header-mode' (used by activities.el when using activites-list), and I am facing the issue that I cannot seem to get the 'k' key to work.

This is what I am trying:

    (evil-define-minor-mode-key 'normal 'vtable-header-mode
      (kbd "h") 'vtable-previous-column
      (kbd "l") 'vtable-next-column
      (kbd "j") 'evil-next-line
      (kbd "k") 'evil-previous-line)

Everything works except for the 'k' key - this is still bound as follows:

k runs the command #[257 "\300!\207" [#<subr F616e6f6e796d6f75732d6c616d626461anonymouslambda16>] 3 "

(fn OBJECT)" (byte-code "\300 C\207" [vtable-current-object] 1)]

I suspect activities.el does something non-standard, and this is why I cannot rebind it?

Oh and a related question - I managed to screw up my emacs state by first trying: evil-define-minor-mode-key 'normal 'vtable-header-mode-map This lead to my keybindings being bound globally I think, and I could not use the 'h' and 'l' keys anymore at all! I had to restart emacs to get back to a working state, since I could not figure out a way to undo that. I think the default behaviour should be to not bind a key if the mode map is invalid, what do you think? And, is there is a way to restore the previous (default) keybindings after a mistake like this?