GNU bug report logs - #447
last-nonmenu-event and sub-menus

Previous Next

Package: emacs;

Reported by: Glenn Morris <rgm <at> gnu.org>

Date: Wed, 18 Jun 2008 23:15:03 UTC

Severity: normal

Done: martin rudalics <rudalics <at> gmx.at>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 447 in the body.
You can then email your comments to 447 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#447; Package emacs. Full text and rfc822 format available.

Message #3 received at submit <at> emacsbugs.donarmstrong.com (full text, mbox):

From: Glenn Morris <rgm <at> gnu.org>
To: bug-gnu-emacs <at> gnu.org
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.





Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#447; Package emacs. Full text and rfc822 format available.

Acknowledgement sent to Chong Yidong <cyd <at> stupidchicken.com>:
Extra info received and forwarded to list. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>. Full text and rfc822 format available.

Message #8 received at 447 <at> emacsbugs.donarmstrong.com (full text, mbox):

From: Chong Yidong <cyd <at> stupidchicken.com>
To: Glenn Morris <rgm <at> gnu.org>
Cc: 447 <at> debbugs.gnu.org
Subject: Re: last-nonmenu-event and sub-menus
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?




Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#447; Package emacs. Full text and rfc822 format available.

Message #11 received at 447 <at> emacsbugs.donarmstrong.com (full text, mbox):

From: Glenn Morris <rgm <at> gnu.org>
To: Chong Yidong <cyd <at> stupidchicken.com>
Cc: 447 <at> debbugs.gnu.org
Subject: Re: last-nonmenu-event and sub-menus
Date: Thu, 09 Oct 2008 12:55:09 -0400
Chong Yidong wrote:

> 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?

I still see it. Do you see it with Emacs 22 even?




Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#447; Package emacs. (Sun, 04 Jan 2009 13:20:05 GMT) Full text and rfc822 format available.

Acknowledgement sent to martin rudalics <rudalics <at> gmx.at>:
Extra info received and forwarded to list. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>. (Sun, 04 Jan 2009 13:20:05 GMT) Full text and rfc822 format available.

Message #16 received at 447 <at> emacsbugs.donarmstrong.com (full text, mbox):

From: martin rudalics <rudalics <at> gmx.at>
To: 447 <at> debbugs.gnu.org
Cc: Glenn Morris <rgm <at> gnu.org>
Subject: Re: last-nonmenu-event and sub-menus
Date: Sun, 04 Jan 2009 14:07:58 +0100
[Message part 1 (text/plain, inline)]
> 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.

Glenn, just for fun please try the attached patch.  It seems to solve
your problem here but I have no idea whether it has any detrimental
side-effects.

martin
[keyboard.c.diff (text/plain, inline)]
*** keyboard.c.~1.986.~	2009-01-03 17:35:34.328125000 +0100
--- keyboard.c	2009-01-04 13:59:34.328125000 +0100
***************
*** 2548,2553 ****
--- 2548,2555 ----
  
    if (CONSP (Vunread_command_events))
      {
+       int was_disabled = 0;
+ 
        c = XCAR (Vunread_command_events);
        Vunread_command_events = XCDR (Vunread_command_events);
  
***************
*** 2568,2579 ****
        if (CONSP (c)
  	  && EQ (XCDR (c), Qdisabled)
  	  && (SYMBOLP (XCAR (c)) || INTEGERP (XCAR (c))))
! 	c = XCAR (c);
  
        /* If the queued event is something that used the mouse,
           set used_mouse_menu accordingly.  */
        if (used_mouse_menu
! 	  && (EQ (c, Qtool_bar) || EQ (c, Qmenu_bar)))
  	*used_mouse_menu = 1;
  
        goto reread_for_input_method;
--- 2570,2584 ----
        if (CONSP (c)
  	  && EQ (XCDR (c), Qdisabled)
  	  && (SYMBOLP (XCAR (c)) || INTEGERP (XCAR (c))))
! 	{
! 	  was_disabled = 1;
! 	  c = XCAR (c);
! 	}
  
        /* If the queued event is something that used the mouse,
           set used_mouse_menu accordingly.  */
        if (used_mouse_menu
! 	  && (EQ (c, Qtool_bar) || EQ (c, Qmenu_bar) || was_disabled))
  	*used_mouse_menu = 1;
  
        goto reread_for_input_method;

Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#447; Package emacs. (Fri, 09 Jan 2009 20:10:03 GMT) Full text and rfc822 format available.

Message #19 received at 447 <at> emacsbugs.donarmstrong.com (full text, mbox):

From: Glenn Morris <rgm <at> gnu.org>
To: martin rudalics <rudalics <at> gmx.at>
Cc: 447 <at> debbugs.gnu.org
Subject: Re: last-nonmenu-event and sub-menus
Date: Fri, 09 Jan 2009 15:01:53 -0500
martin rudalics wrote:

> Glenn, just for fun please try the attached patch.  It seems to solve
> your problem here but I have no idea whether it has any detrimental
> side-effects.

Yes, it seems to fix the problem, thank you.




Reply sent to martin rudalics <rudalics <at> gmx.at>:
You have taken responsibility. (Mon, 12 Jan 2009 10:05:06 GMT) Full text and rfc822 format available.

Notification sent to Glenn Morris <rgm <at> gnu.org>:
bug acknowledged by developer. (Mon, 12 Jan 2009 10:05:06 GMT) Full text and rfc822 format available.

Message #24 received at 447-done <at> emacsbugs.donarmstrong.com (full text, mbox):

From: martin rudalics <rudalics <at> gmx.at>
To: 447-done <at> debbugs.gnu.org
Cc: Glenn Morris <rgm <at> gnu.org>
Subject: Re: last-nonmenu-event and sub-menus
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




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> emacsbugs.donarmstrong.com. (Mon, 09 Feb 2009 15:24:11 GMT) Full text and rfc822 format available.

This bug report was last modified 16 years and 133 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.