VM

Comment 2 for bug 605799

Revision history for this message
Tim Cross (tcross) wrote :

This is being a very tenacious little bug. In fact it is beginning to look more and more like an emacs issue rather than a vm one.

First of all, I'm not getting the same observed behavior. The Help->Switch to emacs toolbar option works as expected for me with latest emacs 24. However, the top-level [VM] option to switch back to the vm menu does nothing (apart from stealing focus - you have to click a second time to regain focus. You can restore the vm menu by manually running M-x vm-menu-toggle-menubar.

I have distilled things down to a simple test case to add a menu to the scratch buffer. The code shows the same exact problem. However, if you add an item in the same way to a sub-menu (i.e. not a top level menu) then the code woks as expected. It appears there is some issue with adding top-level menu actions (as opposed to top level sub-menus).

I have had one report that the test code worked under a recent build of emacs 24 for windows. maybe the problem is fixed there?

Will now test under recent emacs 24 and latest emacs 23 to see if it makes any difference. Waiting to see what responses I get to my post to the emacs-devel list - will likely lodge a bug report for emacs.

The test case I've been using is outline in the post I made to emacs-dev and gnu.emacs.help - copied below for reference....

Hi all,

hoping someone can help me with a problem I'm having when trying to add a new item to a top level menu. The item is an action rather than another menu. I'm doing this to fix some code that worked in emacs 21, but does not work in emacs 23 (or emacs 22 I believe). I've tried to boil it down to a basic recipe shown below.

I'm experimenting in the scratch buffer. This is in emacs 24.0.50 on Linux, but the problem occurs under windows as well.

; a simple test action
(defun tx-greet ()
  (interactive)
  (message "Hello Tim!"))

If I execute

(defun tx-menu ()
  (interactive)
  (define-key lisp-interaction-mode-map [menu-bar tx]
    (cons "TX" (make-sparse-keymap)))
  (define-key lisp-interaction-mode-map [menu-bar tx tx-test]
    '(menu-item "TX Test" tx-greet)))

I get a new menu item "TX" and clicking on that gives a sub-menu with one item "TX Test". Clicking on this item and the message "Hello Tim!" appears in the minibuffer. All works as expected.

However, if I just define the function as

(defun tx-menu ()
  (interactive)
  (define-key lisp-interaction-mode-map [menu-bar tx]
    '(menu-item "TX Test" tx-greet)))

I get the expected menu item at the top level, but clicking on it does nothing - well, it grabs focus, the item is highlighted and you have to click again to release focus.

So, what am I doing wrong? I've looked at menu-bar.el and I believe my code is the same as other examples in that file which add a top level menu action i.e. quit for the ns port etc. According to the manual, the definition looks OK and presumably a similar definition use to work in emacs 21. I've checked the NEWS files and cannot see anything which looks relevant. Can someone give me some clues as at this point, I'm stumped!

thanks,

Tim