Subject: Re: last-nonmenu-event and sub-menus

From: Chong Yidong <[email-masked]>
Date: Wed, 08 Oct 2008 18:41:45 -0400

> last-nonmenu-event returns a bad value when submenus are involved.
> This applies to 22.2 and the current CVS. As an example:
>
> emacs -Q
>
> ;; Evaluate this code:
> (defun bar ()
>   (interactive)
>   (message "%s :: %s" last-nonmenu-event
>      (posn-window (event-start last-nonmenu-event)))
>   (sit-for 5))
> (global-set-key
>  [down-mouse-2]
>  '(menu-item "foo"
>              (keymap "foo"
>                      (bar menu-item "bar" bar)
>                      (submenu menu-item "submenu"
>                               (keymap "submenu" (bar menu-item "bar" bar))))))
> C-x 2
> Put "scratch" in one window, "messages" in the other.
> Select "messages" window.
> Move mouse over "scratch", but do not select it.
> Press mouse-2, and select the "bar" menu-item.
>
> When called from the submenu, `bar' returns a bad result:
>
> bar :: #<window 7 on *Messages*>
>
> The window is wrong, etc.

Hi Glenn,

I can't seem to reproduce this now, using the latest Emacs CVS.  Maybe
it's been fixed in the meantime.  Do you still see this behavior?