On Fri, Feb 25, 2011 at 11:52 AM, Drew Adams <address@hidden>
(message "Hello Tim!"))
(defun tx-menu ()
(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?
Doing just what you said works for me. I get a
`TX Test' menu at the top level. Clicking it shows the message `Hello Tim!'. I
used a recent Windows build of Emacs 24 (emacs -Q).
Did you test with `emacs -Q'?
Did you remember to do `M-x t-menu'?
Did you look in *Messages* for the message (in case it
was too quick).
Did you already have a *scratch* buffer (or other
buffer in Lisp Interaction Mode).
If so, try killing it and revisiting
(But if you see the menu `TX Test' then it should be
You can also try running the functions on
Or (run-hooks 'activate-menubar-hook
But again if you see `TX Test' then it should be
(IOW, I don't know what's wrong,
thanks for the response. It doesn't work for me with emacs -Q. I get the menu item right before the lisp-interaction menu, but clicking on it just highlights it and nothing happens, except the focus is stolen and you cannot do anything until you click on it a second time. There is nothing in the messages buffer apart from the tx-greet and tx-menu lines that are added when you evaluate the functions. I can run tx-greet and it does what it should and running the tx-menu adds the entry which does nothing. There is no other scratch buffer.
I'm running a recent (last couple of days) version of emacs 24 from bzr. I'll update and try again. Sems odd it will work for you but not me when we are running similar versions, but a windows build v linux 64bit build. I'll also try with latest emacs 23 and see if I get the same issue.
It would be good if someone else can try on Linux (especially 64bit) and it would be interesting to know if it works with a build using the old X11 libs rather than gtk, just to rule that out as the difference.
If nobody can see a problem with the code I'm using, I'm suspecting it is either a bug or an undocumented feature (i.e. cannot have menu acitons at the top level, only sub-menus since the same code appears to work fine if it is in a sub-menu).