Subject: Re: bug#7466: 24.0.50; (emacs) `Menu Mouse Clicks' conflicts with code obsolescence

From: Stefan Monnier <[email-masked]>
Date: Wed, 03 Aug 2011 10:54:12 -0400

>>> I assume that we're not asking people to bind mouse-3 to
>>> (mouse-menu-major-mode-map)?
>> Why would you assume so?
> Because I tried that, and it didn't give me the same menu that's
> currently on `C-mouse-3'.  :-)

Oh, right it's not what I thought.  Yes, it's a bit inconvenient to move
the mapping from C-mouse-3 to mouse-3 because you really want to put
onto mouse-3 the menu-item that's on C-mouse-3, but

(global-set-key [down-mouse-3] (key-binding [C-down-mouse-3]))

will only give you the keymap returned by mouse-menu-major-mode-map
rather than the menu-item itself.  You'd like to be able to do:

  (global-set-key [down-mouse-3] [C-down-mouse-3])

But that doesn't work because such remapping don't work right for events
with parameters such as mouse clicks.  I guess you can do:

  (global-set-key [down-mouse-3] (cdr (assq 'C-down-mouse-3 global-map)))

but it's ugly.  Maybe we need a way to ask `key-binding' to return
menu-items rather than the binding specified in them.  But key-binding
already takes many parameters..maybe we could abuse the `no-remap' arg
for that?

        Stefan