From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.ciao.gmane.io!not-for-mail From: Tim Johnson Newsgroups: gmane.emacs.help Subject: Re: Multiple keymaps for a minor mode Date: Fri, 24 Jan 2020 09:47:57 -0900 Message-ID: <512ba5b7-270d-8fdb-5c41-eea3d504a195@akwebsoft.com> References: <5b95b5d1-9da3-66a0-b652-376421b80075@akwebsoft.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="ciao.gmane.io:159.69.161.202"; logging-data="70724"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.9.0 To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Fri Jan 24 19:48:57 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 1iv40m-000IMb-Se for geh-help-gnu-emacs@m.gmane-mx.org; Fri, 24 Jan 2020 19:48:56 +0100 Original-Received: from localhost ([::1]:46510 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iv40l-0008Rj-SN for geh-help-gnu-emacs@m.gmane-mx.org; Fri, 24 Jan 2020 13:48:55 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:46052) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iv405-0008RY-0u for help-gnu-emacs@gnu.org; Fri, 24 Jan 2020 13:48:14 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iv403-0007W0-UQ for help-gnu-emacs@gnu.org; Fri, 24 Jan 2020 13:48:12 -0500 Original-Received: from gateway22.websitewelcome.com ([192.185.47.163]:13911) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1iv403-0007KH-Lg for help-gnu-emacs@gnu.org; Fri, 24 Jan 2020 13:48:11 -0500 Original-Received: from cm17.websitewelcome.com (cm17.websitewelcome.com [100.42.49.20]) by gateway22.websitewelcome.com (Postfix) with ESMTP id 7C6675EA0 for ; Fri, 24 Jan 2020 12:47:59 -0600 (CST) Original-Received: from host2075.hostmonster.com ([67.20.113.97]) by cmsmtp with SMTP id v3zrisZJ8mgNjv3zriz6y3; Fri, 24 Jan 2020 12:47:59 -0600 X-Authority-Reason: nr=8 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=tj49.com; s=default; h=Content-Transfer-Encoding:Content-Type:In-Reply-To:MIME-Version :Date:Message-ID:From:References:To:Subject:Sender:Reply-To:Cc:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=n/eLXj/IgCuiMk1ey0JyuQa+A0xjlSvttS7wIbDzwLs=; b=bXaqXohHRNtn8oywpEcj6OMs6R XhlIuA8eXa8glb5rUMAnGR4xzTyoeyyLPmWbww0JmnVMlZjJP8xo+FGJ3ZnbnU1tdnZIstPjNq52u FeMoaD223iP38r8VVVRFjP/p2; Original-Received: from tjohnson.mtaonline.net ([64.4.232.191]:47122 helo=[192.168.1.6]) by host2075.hostmonster.com with esmtpsa (TLSv1.2:ECDHE-RSA-AES128-GCM-SHA256:128) (Exim 4.92) (envelope-from ) id 1iv3zq-003G9f-Us for help-gnu-emacs@gnu.org; Fri, 24 Jan 2020 11:47:59 -0700 In-Reply-To: <5b95b5d1-9da3-66a0-b652-376421b80075@akwebsoft.com> Content-Language: en-US X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - host2075.hostmonster.com X-AntiAbuse: Original Domain - gnu.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - akwebsoft.com X-BWhitelist: no X-Source-IP: 64.4.232.191 X-Source-L: No X-Exim-ID: 1iv3zq-003G9f-Us X-Source-Sender: tjohnson.mtaonline.net ([192.168.1.6]) [64.4.232.191]:47122 X-Source-Auth: tim@tj49.com X-Email-Count: 1 X-Source-Cap: bW9sZG92YXM7bW9sZG92YXM7aG9zdDIwNzUuaG9zdG1vbnN0ZXIuY29t X-Local-Domain: yes X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 192.185.47.163 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:122292 Archived-At: On 1/23/20 9:57 AM, Tim Johnson wrote: > Using GNU Emacs 26.1 on ubuntu > > ;; I use the following code to establish a minor mode > > (defvar tj-mode-map (make-sparse-keymap) > =C2=A0 "Keymap for `tj-mode'.") > > ;;;###autoload > (define-minor-mode tj-minor-mode > =C2=A0 "This minor mode enables my key settings to override conflicting= =20 > modes." > =C2=A0 :init-value t > =C2=A0 :lighter " -tj-" > =C2=A0 :keymap tj-mode-map) > > ;;;###autoload > (define-globalized-minor-mode global-tj-minor-mode tj-minor-mode=20 > tj-minor-mode) > > (add-to-list 'emulation-mode-map-alists `((tj-minor-mode .=20 > ,tj-mode-map))) > ;; End code > > I wish to separate `tj-mode-map into a number of individual mode maps=20 > that are configured by category. This would give me the advantage of=20 > using a function called > > which-key--create-buffer-and-show=C2=A0 from the which-key package to=20 > implement a menu showing commands bound to keys by functionality or=20 > category. > > the :keymap member of define-mode-map is what binds the keymap to the=20 > mode. > > Can I use multiple :keymap entries, one for each keymap or must I=20 > define a minor mode for each of my custom keymaps? > > Certainly the latter is doable, but I like to save keystrokes :) > No worries ... it is an easy enough pattern to follow. cheers --=20 Tim tj49.com