[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Multiple keymaps for a minor mode
From: |
Stefan Monnier |
Subject: |
Re: Multiple keymaps for a minor mode |
Date: |
Thu, 23 Jan 2020 15:49:11 -0500 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) |
> (defvar tj-mode-map (make-sparse-keymap)
> "Keymap for `tj-mode'.")
>
> ;;;###autoload
> (define-minor-mode tj-minor-mode
> "This minor mode enables my key settings to override conflicting modes."
> :init-value t
> :lighter " -tj-"
> :keymap tj-mode-map)
This last line can be removed if you rename `tj-mode-map` to
`tj-minor-mode-map`.
> (add-to-list 'emulation-mode-map-alists `((tj-minor-mode . ,tj-mode-map)))
This is redundant with the keymap setup of `define-minor-mode`, so you'd
be better off just not using the :keymap of `define-minor-mode`.
> Can I use multiple :keymap entries, one for each keymap
No, `define-minor-mode` does not support that.
> or must I define a minor mode for each of my custom keymaps?
Not a good idea either.
But you can simply your various keymaps to `emulation-mode-map-alists`
manually like you already do.
Stefan