From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: =?ISO-8859-1?Q?Jan_Dj=E4rv?= Newsgroups: gmane.emacs.devel Subject: Re: Modify menu-bar help Date: Fri, 25 Feb 2011 11:03:16 +0100 Message-ID: <4D677E64.9010400@swipnet.se> References: <22CD3A4D8F6B4B5A8F20A4FBE74BAD10@us.oracle.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Trace: dough.gmane.org 1298628365 13568 80.91.229.12 (25 Feb 2011 10:06:05 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Fri, 25 Feb 2011 10:06:05 +0000 (UTC) Cc: emacs-devel@gnu.org To: Tim Cross Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Feb 25 11:05:59 2011 Return-path: Envelope-to: ged-emacs-devel@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 1PsuYf-0008Q7-P7 for ged-emacs-devel@m.gmane.org; Fri, 25 Feb 2011 11:05:58 +0100 Original-Received: from localhost ([127.0.0.1]:48929 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PsuYe-0006PE-Ss for ged-emacs-devel@m.gmane.org; Fri, 25 Feb 2011 05:05:56 -0500 Original-Received: from [140.186.70.92] (port=41206 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PsuYA-0005xM-Aw for emacs-devel@gnu.org; Fri, 25 Feb 2011 05:05:36 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PsuW7-0006Xe-JE for emacs-devel@gnu.org; Fri, 25 Feb 2011 05:03:28 -0500 Original-Received: from smtprelay-h31.telenor.se ([213.150.131.4]:45190) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PsuW7-0006Wf-5r for emacs-devel@gnu.org; Fri, 25 Feb 2011 05:03:19 -0500 Original-Received: from ipb2.telenor.se (ipb2.telenor.se [195.54.127.165]) by smtprelay-h31.telenor.se (Postfix) with ESMTP id B8C91EB854 for ; Fri, 25 Feb 2011 11:03:17 +0100 (CET) X-SENDER-IP: [85.225.45.100] X-LISTENER: [smtp.bredband.net] X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AqM4AGoNZ01V4S1kPGdsb2JhbACIbZ1MDAEBAQE1ML0GhWAEj1s X-IronPort-AV: E=Sophos;i="4.62,224,1297033200"; d="scan'208";a="175662372" Original-Received: from c-642de155.25-1-64736c10.cust.bredbandsbolaget.se (HELO coolsville.localdomain) ([85.225.45.100]) by ipb2.telenor.se with ESMTP; 25 Feb 2011 11:03:17 +0100 Original-Received: from [172.20.199.2] (gaffa [172.20.199.2]) by coolsville.localdomain (Postfix) with ESMTP id 8A5497FA05A; Fri, 25 Feb 2011 11:03:16 +0100 (CET) User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.13) Gecko/20101208 Thunderbird/3.1.7 In-Reply-To: X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 213.150.131.4 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:136488 Archived-At: 2011-02-25 06:14, Tim Cross skrev: > > > On Fri, Feb 25, 2011 at 11:52 AM, Drew Adams > 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.