Subject: bug#447 closed by martin rudalics <[email-masked]> (Re: last-nonmenu-event and sub-menus)

From: [email-masked] (Emacs bug Tracking System)
Date: Mon, 12 Jan 2009 10:05:06 +0000

This is an automatic notification regarding your bug report
which was filed against the emacs package:

#447: last-nonmenu-event and sub-menus

It has been closed by martin rudalics <[email-masked]>.

Their explanation is attached below along with your original report.
If this explanation is unsatisfactory and you have not received a
better one in a separate message then please contact martin rudalics <[email-masked]> by
replying to this email.

-- 
447: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=447
Emacs Bug Tracking System
Contact [email-masked] with problems

Subject: Re: last-nonmenu-event and sub-menus
From: martin rudalics <[email-masked]>
To: [email-masked]
Cc: Glenn Morris <[email-masked]>
Date: Mon, 12 Jan 2009 10:58:44 +0100

Fixed as

	* keyboard.c (read_char): Fix case where last_nonmenu_event
	returned a bad value with submenus.  (Bug#447)

martin

>From [email-masked] Wed Jun 18 16:09:15 2008
From: Glenn Morris <[email-masked]>
To: [email-masked]
Subject: last-nonmenu-event and sub-menus
Date: Wed, 18 Jun 2008 19:06:54 -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 top-level menu, `bar' correctly returns:

(down-mouse-2 (#<window 3 on *scratch*> 534 (251 . 101) 2649593899 nil
534 (27 . 6) nil (8 . 11) (9 . 15))) :: #<window 3 on *scratch*>

When called from the submenu, `bar' returns a bad result:

bar :: #<window 7 on *Messages*>

The window is wrong, etc.