From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Tim X Newsgroups: gmane.emacs.help Subject: modify top level menu problem Date: Fri, 25 Feb 2011 11:24:55 +1100 Organization: Unlimited download news at news.astraweb.com Message-ID: <871v2xc65k.fsf@rapttech.com.au> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: dough.gmane.org 1298594451 31867 80.91.229.12 (25 Feb 2011 00:40:51 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Fri, 25 Feb 2011 00:40:51 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Fri Feb 25 01:40:47 2011 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1Psljj-0004ty-5C for geh-help-gnu-emacs@m.gmane.org; Fri, 25 Feb 2011 01:40:47 +0100 Original-Received: from localhost ([127.0.0.1]:34292 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Pslji-0005dq-Ll for geh-help-gnu-emacs@m.gmane.org; Thu, 24 Feb 2011 19:40:46 -0500 Original-Path: usenet.stanford.edu!news.glorb.com!news2.glorb.com!news.glorb.com!news.astraweb.com!border6.newsrouter.astraweb.com!not-for-mail Original-Newsgroups: gnu.emacs.help User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux) Cancel-Lock: sha1:Xgbynpug1qt2HZRUuq5RXu2L+T0= Original-Lines: 39 Original-NNTP-Posting-Host: 6155a323.news.astraweb.com Original-X-Trace: DXC=31GImAV^?kWSCAkl5c@Xgk^jZU; H\ZjCeXCQ^LUW1\b3\ Original-Xref: usenet.stanford.edu gnu.emacs.help:185302 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:79457 Archived-At: 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