emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: address@hidden: RE: menu entries missing display of equivalent keybo


From: Stefan Monnier
Subject: Re: address@hidden: RE: menu entries missing display of equivalent keyboard sequence]
Date: Tue, 28 Jan 2003 17:50:07 -0500

>     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);
 





reply via email to

[Prev in Thread] Current Thread [Next in Thread]