From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: "Stefan Monnier" Newsgroups: gmane.emacs.devel Subject: Re: bug/feature - emacs doesn't tell you about keys with multiple prefixes Date: Sun, 16 Mar 2003 05:14:09 -0500 Sender: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Message-ID: <200303161014.h2GAE90Q009917@rum.cs.yale.edu> References: <15932.56789.564317.739477@hkn.eecs.berkeley.edu> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: main.gmane.org 1047809800 924 80.91.224.249 (16 Mar 2003 10:16:40 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Sun, 16 Mar 2003 10:16:40 +0000 (UTC) Cc: Emacs Developement List Original-X-From: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Sun Mar 16 11:16:38 2003 Return-path: Original-Received: from quimby.gnus.org ([80.91.224.244]) by main.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 18uVBk-0000ES-00 for ; Sun, 16 Mar 2003 11:16:20 +0100 Original-Received: from monty-python.gnu.org ([199.232.76.173]) by quimby.gnus.org with esmtp (Exim 3.12 #1 (Debian)) id 18uVar-00011J-00 for ; Sun, 16 Mar 2003 11:42:18 +0100 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.10.13) id 18uVAo-00035Z-00 for emacs-devel@quimby.gnus.org; Sun, 16 Mar 2003 05:15:22 -0500 Original-Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.10.13) id 18uV9w-0002Cl-00 for emacs-devel@gnu.org; Sun, 16 Mar 2003 05:14:28 -0500 Original-Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.10.13) id 18uV9h-0001D2-00 for emacs-devel@gnu.org; Sun, 16 Mar 2003 05:14:19 -0500 Original-Received: from rum.cs.yale.edu ([128.36.229.169]) by monty-python.gnu.org with esmtp (Exim 4.10.13) id 18uV9e-00014U-00 for emacs-devel@gnu.org; Sun, 16 Mar 2003 05:14:10 -0500 Original-Received: from rum.cs.yale.edu (localhost [127.0.0.1]) by rum.cs.yale.edu (8.12.8/8.12.8) with ESMTP id h2GAE9Pe009919; Sun, 16 Mar 2003 05:14:09 -0500 Original-Received: (from monnier@localhost) by rum.cs.yale.edu (8.12.8/8.12.8/Submit) id h2GAE90Q009917; Sun, 16 Mar 2003 05:14:09 -0500 X-Mailer: exmh version 2.4 06/23/2000 with nmh-1.0.4 Original-To: Karl Chen X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1b5 Precedence: list List-Id: Emacs development discussions. List-Help: List-Post: List-Subscribe: , List-Archive: List-Unsubscribe: , Errors-To: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Xref: main.gmane.org gmane.emacs.devel:12386 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:12386 > With the code below, if you do "C-h k M-b M-a" , Emacs will tell you that > mark-paragraph is on "M-h, M-a, M-b" ; it will not tell you that it is also on > M-b M-a or M-b M-b (even though you just pressed those keys to get to this > screen!). Same goes with the "matched:" message when you type M-x > mark-paragraph (before you hit RET). > > Regardless of bad coding style etc I it is useful to have aliases for prefixes > - for example I like using M-v instead of/in addition to C-x v and the easiest > way to do this is to (global-set-key [ (meta v) ] vc-prefix-map). This > confusing behavior of displaying only keys under the first key bound to a > keymap exists in Emacs 21 for the "M-x ... [matched; ]" message and in > Emacs CVS for describe-key as well. > > > > (global-set-key [(meta a)] nil) > (global-set-key [(meta b)] nil) > > (global-set-key [(meta a) (meta a)] 'mark-paragraph) > (global-set-key [(meta a) (meta b)] 'mark-paragraph) > > ;;; >>>>>>>>>>>>>>>>>>>>> > (global-set-key [(meta b)] (lookup-key (current-global-map) [(meta a)])) > ;;; <<<<<<<<<<<<<<<<<<<<< > > ;; after the previos line, these two lines have no effect on the reverse key lookups. > (global-set-key [(meta b) (meta a)] 'mark-paragraph) > (global-set-key [(meta b) (meta b)] 'mark-paragraph) It seems that it is done "on purpose". In accessible-keymaps (used by where-is-internal), there is an explicit check to remove any duplicate keymaps (i.e. the same keymap appearing under another prefix). Look for Frassq in accessible_keymaps_1 in keymap.c. I'm not sure why it's there, but it's been there "for ever" (i.e. since revision 1.1 of the file). One benefit of removing duplicates is that it prevents us from getting stuck in a cycle, although I'm not sure how important this is. Stefan