From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.ciao.gmane.io!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.help Subject: Re: Multiple keymaps for a minor mode Date: Thu, 23 Jan 2020 15:49:11 -0500 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="ciao.gmane.io:159.69.161.202"; logging-data="52304"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) To: help-gnu-emacs@gnu.org Cancel-Lock: sha1:G6FdfPiLtRcxidiwGtUZ2EpAxrc= Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Thu Jan 23 21:49:34 2020 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1iujPy-000DYT-4E for geh-help-gnu-emacs@m.gmane-mx.org; Thu, 23 Jan 2020 21:49:34 +0100 Original-Received: from localhost ([::1]:33878 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iujPx-00076g-8k for geh-help-gnu-emacs@m.gmane-mx.org; Thu, 23 Jan 2020 15:49:33 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:50144) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iujPg-00076V-L5 for help-gnu-emacs@gnu.org; Thu, 23 Jan 2020 15:49:17 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iujPf-0008Dv-MV for help-gnu-emacs@gnu.org; Thu, 23 Jan 2020 15:49:16 -0500 Original-Received: from ciao.gmane.io ([159.69.161.202]:48002) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1iujPf-0008DH-HB for help-gnu-emacs@gnu.org; Thu, 23 Jan 2020 15:49:15 -0500 Original-Received: from list by ciao.gmane.io with local (Exim 4.92) (envelope-from ) id 1iujPe-000DCu-Gc for help-gnu-emacs@gnu.org; Thu, 23 Jan 2020 21:49:14 +0100 X-Injected-Via-Gmane: http://gmane.org/ X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 159.69.161.202 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "help-gnu-emacs" Xref: news.gmane.io gmane.emacs.help:122277 Archived-At: > (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