all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: "Stefan Monnier" <monnier+gnu/emacs@rum.cs.yale.edu>
Cc: Stefan Monnier <monnier+gnu/emacs@rum.cs.yale.edu>
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	[thread overview]
Message-ID: <200301282250.h0SMo7M11772@rum.cs.yale.edu> (raw)
In-Reply-To: E18Zh7M-0000lH-00@fencepost.gnu.org

>     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	other threads:[~2003-01-28 22:50 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <E18QEHY-00040s-00@fencepost.gnu.org>
2003-01-16  0:13 ` [andrew.maguire@ps.ge.com: RE: menu entries missing display of equivalent keyboard sequence] Stefan Monnier
2003-01-18  0:45   ` Richard Stallman
2003-01-28 22:50     ` Stefan Monnier [this message]
2003-01-29 21:17       ` Richard Stallman
2003-01-30 15:21         ` Stefan Monnier
2003-01-31 19:20           ` Richard Stallman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200301282250.h0SMo7M11772@rum.cs.yale.edu \
    --to=monnier+gnu/emacs@rum.cs.yale.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.