all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Stefan Monnier <monnier@iro.umontreal.ca>
To: help-gnu-emacs@gnu.org
Subject: Re: Multiple keymaps for a minor mode
Date: Thu, 23 Jan 2020 15:49:11 -0500	[thread overview]
Message-ID: <jwv5zh16gwj.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: d4e167b5-bab2-f7ff-94f6-9e8c85a20915@akwebsoft.com

> (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




  reply	other threads:[~2020-01-23 20:49 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-23  1:58 Multiple keymaps for a minor mode Tim Johnson
2020-01-23 20:49 ` Stefan Monnier [this message]
2020-02-19 23:26   ` Tim Johnson
2020-02-21 16:16     ` Stefan Monnier
2020-02-21 18:22       ` Tim Johnson
2020-02-26 12:05 ` Michael Heerdegen
2020-02-26 19:05   ` Tim Johnson
2020-02-26 20:24     ` Drew Adams
2020-02-27  0:02       ` Tim Johnson
2020-03-04 15:47     ` Michael Heerdegen
2020-03-05 18:51       ` Tim Johnson
2020-03-05 23:54         ` Michael Heerdegen
2020-03-06  0:45           ` Tim Johnson
  -- strict thread matches above, loose matches on Subject: below --
2020-01-23 18:57 Tim Johnson
2020-01-24 18:47 ` Tim Johnson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=jwv5zh16gwj.fsf-monnier+emacs@gnu.org \
    --to=monnier@iro.umontreal.ca \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.