emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Modify menu-bar help


From: Jan Djärv
Subject: Re: Modify menu-bar help
Date: Fri, 25 Feb 2011 11:03:16 +0100
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.13) Gecko/20101208 Thunderbird/3.1.7

2011-02-25 06:14, Tim Cross skrev:


On Fri, Feb 25, 2011 at 11:52 AM, Drew Adams <address@hidden
<mailto:address@hidden>> wrote:

        (defun tx-greet ()
           (interactive)
           (message "Hello Tim!"))

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

    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 (recreating) it.
    (But if you see the menu `TX Test' then it should be OK.)
    You can also try running the functions on `menu-bar-update-hook'.
    Or (run-hooks 'activate-menubar-hook 'menu-bar-update-hook).
    But again if you see `TX Test' then it should be OK.
    (IOW, I don't know what's wrong, sorry.)

Hi Drew,

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).

It is a Gtk+ thing. Menubars are only supposed to have menus, not buttons. Buttons should go in tool bars. You can't even put in buttons in a Gtk+ menu bar, you can only put in menu items, and they tend to "steal" all mouse presses before Emacs sees them. Maybe there is a way around this, but it is not worth it. Besides, we always create an empty sub menu if there isn't one because some themes assume a submenu and draws things incorrectly if there isn't one.

        Jan D.


        Jan D.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]