From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Alan Mackenzie Newsgroups: gmane.emacs.devel Subject: Re: Keymap initialization (was: [Emacs-diffs] master 7a2038d: Create a toggle between block and line comments in CC Mode) Date: Mon, 26 Jun 2017 16:39:57 +0000 Message-ID: <20170626163957.GB2471@acm> References: <20170615210438.18512.16715@vcs0.savannah.gnu.org> <20170615210440.2D57C206CD@vcs0.savannah.gnu.org> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: blaine.gmane.org 1498495284 17914 195.159.176.226 (26 Jun 2017 16:41:24 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Mon, 26 Jun 2017 16:41:24 +0000 (UTC) User-Agent: Mutt/1.7.2 (2016-11-26) Cc: emacs-devel@gnu.org To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Jun 26 18:41:19 2017 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dPX4d-00043c-T0 for ged-emacs-devel@m.gmane.org; Mon, 26 Jun 2017 18:41:15 +0200 Original-Received: from localhost ([::1]:47609 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dPX4f-00089w-Qu for ged-emacs-devel@m.gmane.org; Mon, 26 Jun 2017 12:41:17 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:53838) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dPX4Y-000888-UR for emacs-devel@gnu.org; Mon, 26 Jun 2017 12:41:11 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dPX4W-0000my-Bw for emacs-devel@gnu.org; Mon, 26 Jun 2017 12:41:10 -0400 Original-Received: from ocolin.muc.de ([193.149.48.4]:46880 helo=mail.muc.de) by eggs.gnu.org with smtp (Exim 4.71) (envelope-from ) id 1dPX4W-0000mZ-4O for emacs-devel@gnu.org; Mon, 26 Jun 2017 12:41:08 -0400 Original-Received: (qmail 54090 invoked by uid 3782); 26 Jun 2017 16:41:06 -0000 Original-Received: from acm.muc.de (p548C6649.dip0.t-ipconnect.de [84.140.102.73]) by colin.muc.de (tmda-ofmipd) with ESMTP; Mon, 26 Jun 2017 18:41:05 +0200 Original-Received: (qmail 2520 invoked by uid 1000); 26 Jun 2017 16:39:57 -0000 Content-Disposition: inline In-Reply-To: X-Delivery-Agent: TMDA/1.1.12 (Macallan) X-Primary-Address: acm@muc.de X-detected-operating-system: by eggs.gnu.org: FreeBSD 9.x [fuzzy] X-Received-From: 193.149.48.4 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:216003 Archived-At: Hello, Stefan. On Sun, Jun 25, 2017 at 17:29:56 -0400, Stefan Monnier wrote: > > Create a toggle between block and line comments in CC Mode. > [...] > > (c-mode-map, c++-mode-map, objc-mode-map, java-mode-map, idl-mode-map) > > (pike-mode-map, awk-mode-map): Make entries in these key maps each time > > the mode is loaded rather than just once per Emacs session. > This seems completely unrelated. As the commit message (the bit you snipped) said. > > (defvar pike-mode-map > > (let ((map (c-make-inherited-keymap))) > > - ;; Additional bindings. > > - (define-key map "\C-c\C-e" 'c-macro-expand) > > map) > > "Keymap used in pike-mode buffers.") > > +;; Additional bindings. > > +(define-key pike-mode-map "\C-c\C-e" 'c-macro-expand) > This is anti-idiomatic: Emacs's own code has been making the > opposite change over the years in most/all bundled packages. I got sick and tired of having to do M-: (makunbound 'foo-map) before loading files with changed keymaps. As a developer yourself, you should welcome such changes. > There are many ways to skin this cat; the two alternatives above have > both advantages and disadvantages, so I think we should agree on one and > stick to it. Consistency is not Emacs's forte and is not something that > I consider indispensable, but I really don't see why CC-mode's keymaps > need to behave differently from all other major modes. They don't. You press a pertinent key combination and the key maps take you to the matching command. Precisely how these keymaps are constructed and loaded is of lesser importance. > Stefan -- Alan Mackenzie (Nuremberg, Germany).