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: [andrew.maguire@ps.ge.com: RE: menu entries missing display of equivalent keyboard sequence] Date: Tue, 28 Jan 2003 17:50:07 -0500 Sender: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Message-ID: <200301282250.h0SMo7M11772@rum.cs.yale.edu> References: <200301160013.h0G0DHP11708@rum.cs.yale.edu> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: main.gmane.org 1043794430 5707 80.91.224.249 (28 Jan 2003 22:53:50 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Tue, 28 Jan 2003 22:53:50 +0000 (UTC) Cc: Stefan Monnier Return-path: Original-Received: from quimby.gnus.org ([80.91.224.244]) by main.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 18debw-0001TN-00 for ; Tue, 28 Jan 2003 23:53:44 +0100 Original-Received: from monty-python.gnu.org ([199.232.76.173]) by quimby.gnus.org with esmtp (Exim 3.12 #1 (Debian)) id 18degp-0006b1-00 for ; Tue, 28 Jan 2003 23:58:47 +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 18debY-0007QN-05 for emacs-devel@quimby.gnus.org; Tue, 28 Jan 2003 17:53:20 -0500 Original-Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.10.13) id 18deaU-0007CY-00 for emacs-devel@gnu.org; Tue, 28 Jan 2003 17:52:14 -0500 Original-Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.10.13) id 18deZy-0006kN-00 for emacs-devel@gnu.org; Tue, 28 Jan 2003 17:51:43 -0500 Original-Received: from rum.cs.yale.edu ([128.36.229.169]) by monty-python.gnu.org with esmtp (Exim 4.10.13) id 18deYT-00068Y-00; Tue, 28 Jan 2003 17:50:09 -0500 Original-Received: (from monnier@localhost) by rum.cs.yale.edu (8.11.6/8.11.6) id h0SMo7M11772; Tue, 28 Jan 2003 17:50:07 -0500 X-Mailer: exmh version 2.4 06/23/2000 with nmh-1.0.4 Original-To: Richard Stallman Original-cc: andrew.maguire@ps.ge.com Original-cc: emacs-devel@gnu.org 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:11170 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:11170 > So now, the problem is "what is a menu binding" ? > > Perhaps "any binding that starts with menu-bar or tool-bar" is the > right criterion. If you want to catch pop-up menu bindings, you could > add "any binding that starts with a mouse-event symbol and uses it as > a prefix." That is not guaranteed to be correct, but practically > speaking nobody uses mouse-events as prefixes except for pop-up menus. How about the patch below ? Stefan Index: keymap.c =================================================================== RCS file: /cvsroot/emacs/emacs/src/keymap.c,v retrieving revision 1.270 diff -u -u -b -r1.270 keymap.c --- keymap.c 6 Jan 2003 00:53:47 -0000 1.270 +++ keymap.c 28 Jan 2003 22:44:43 -0000 @@ -2236,6 +2368,8 @@ return Qnil; } +static Lisp_Object Vmenu_events; + /* This function can GC if Flookup_key autoloads any keymaps. */ static Lisp_Object @@ -2274,7 +2408,7 @@ for (; !NILP (maps); maps = Fcdr (maps)) { /* Key sequence to reach map, and the map that it reaches */ - register Lisp_Object this, map; + register Lisp_Object this, map, tem; /* In order to fold [META-PREFIX-CHAR CHAR] sequences into [M-CHAR] sequences, check if last character of the sequence @@ -2290,7 +2424,8 @@ /* if (nomenus && !ascii_sequence_p (this)) */ if (nomenus && XINT (last) >= 0 - && !INTEGERP (Faref (this, make_number (0)))) + && SYMBOLP (tem = Faref (this, make_number (0))) + && !NILP (Fmemq (XCAR (parse_modifiers (tem)), Vmenu_events))) /* If no menu entries should be returned, skip over the keymaps bound to `menu-bar' and `tool-bar' and other non-ascii prefixes like `C-down-mouse-2'. */ @@ -3623,6 +3759,14 @@ and applies even for keys that have ordinary bindings. */); Vkey_translation_map = Qnil; + staticpro (&Vmenu_events); + Vmenu_events = Fcons (intern ("menu-bar"), + Fcons (intern ("tool-bar"), + Fcons (intern ("mouse-1"), + Fcons (intern ("mouse-2"), + Fcons (intern ("mouse-3"), + Qnil))))); + Qsingle_key_description = intern ("single-key-description"); staticpro (&Qsingle_key_description);