* modify top level menu problem
@ 2011-02-25 0:24 Tim X
2011-02-26 0:37 ` Tim X
0 siblings, 1 reply; 2+ messages in thread
From: Tim X @ 2011-02-25 0:24 UTC (permalink / raw
To: help-gnu-emacs
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
--
tcross (at) rapttech dot com dot au
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: modify top level menu problem
2011-02-25 0:24 modify top level menu problem Tim X
@ 2011-02-26 0:37 ` Tim X
0 siblings, 0 replies; 2+ messages in thread
From: Tim X @ 2011-02-26 0:37 UTC (permalink / raw
To: help-gnu-emacs
Tim X <timx@nospam.dev.null> writes:
> 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
Just following up to myself.
It now looks like the reason this code would not work is due to design
decisions within the GTK+ toolkit, which does not allow top-level menu
'actions' (i.e. buttons) only sub-menus. This is not a restriction with
either the Lucid toolkit or apparently on windows.
If anyone is running emacs built with other toolkits, such as on
OXX/nextstep etc, it would be good to know/confirm if this type of
limitaiton also exists. Once I've done a little more confirmation, I
plan to log a request to have the manual updated to mention this
restriciton and it would be good to know which toolkits are affected.
thanks
Tim
--
tcross (at) rapttech dot com dot au
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2011-02-26 0:37 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-02-25 0:24 modify top level menu problem Tim X
2011-02-26 0:37 ` Tim X
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.