I started coding a minor mode to provide some keybindings. My initial attempt had a typo:
(define-minor-mode borked-mode
"A mode defined with a broken key binding"
nil nil
'(([b] . 'previous-line)))
I had intended to use the b
key, and immediately realized that I should have used "b"
instead of [b]
. So I redefined the minor mode:
(define-minor-mode borked-mode
"A mode defined with a broken key binding"
nil nil
'(("b" . 'previous-line)))
However, this didn't work. This set me off on a wild goose chase through all the various ways of binding keys (i.e., (kbd ...), [ ... ], etc). Finally I realized that simply re-evaluating the (define-minor-mode ...)
form was not changing anything, I was stuck with the original, broken key map. I then tried changing the keymap directly via (define-key borked-mode-map ...)
and still couldn't get the corrected keymap loaded. Finally I restarted Emacs, and my minor mode was correctly loaded.
My question is: how do you update a minor mode definition as you develop it? Is there any way to flush a broken definition, or do you have to restart emacs to clear away broken bits?