Reputation: 27
The code below from my .emacs works fine normally but gives me an "Invalid keymap my-keys-mode-map" error when I try to byte compile it.
(eval-and-compile
(defvar my-keys-mode-map (make-sparse-keymap) "my-keys-mode keymap.")
(define-minor-mode my-keys-mode
"A minor mode to override major modes keys."
t " my-keys" 'my-keys-mode-map)
(bind-key "C-;" (quote right-char) my-keys-mode-map)
(bind-key "C-j" (quote left-char) my-keys-mode-map)
)
The error is on the bind-key line. I have tried define-key instead of bind-key, or using make-keymap instead of make-sparse-map but without luck. I am not too proficient with elisp. Is there some other way to define the key-map so that it is recognized by the byte compiler?
Upvotes: 0
Views: 343
Reputation: 30708
Remove the quote in front of the keymap symbol in the define-minor-mode
.
In other words, the minor-mode definition should be this:
(define-minor-mode my-keys-mode
"A minor mode to override major modes keys."
t " my-keys" my-keys-mode-map)
You need to pass a keymap, not a symbol (whose value is a keymap), to define-minor-mode
.
Upvotes: 1