From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: "rgb" Newsgroups: gmane.emacs.help Subject: Re: How to bind pop up menu to a key? Date: 21 Feb 2005 22:16:30 -0800 Organization: http://groups.google.com Message-ID: <1109052990.467199.86400@l41g2000cwc.googlegroups.com> References: <20050221014530.GD19034@SDF.LONESTAR.ORG> <1109019418.5316.3.camel@c83-250-202-177.bredband.comhem.se> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-7" X-Trace: sea.gmane.org 1109053082 1139 80.91.229.2 (22 Feb 2005 06:18:02 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Tue, 22 Feb 2005 06:18:02 +0000 (UTC) Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Tue Feb 22 07:18:02 2005 Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1D3TMi-0006fr-J9 for geh-help-gnu-emacs@m.gmane.org; Tue, 22 Feb 2005 07:17:48 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1D3Tdn-0005po-Hx for geh-help-gnu-emacs@m.gmane.org; Tue, 22 Feb 2005 01:35:27 -0500 Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!postnews.google.com!l41g2000cwc.googlegroups.com!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 46 Original-NNTP-Posting-Host: 67.40.162.228 Original-X-Trace: posting.google.com 1109052994 17675 127.0.0.1 (22 Feb 2005 06:16:34 GMT) Original-X-Complaints-To: groups-abuse@google.com Original-NNTP-Posting-Date: Tue, 22 Feb 2005 06:16:34 +0000 (UTC) User-Agent: G2/0.2 Complaints-To: groups-abuse@google.com Injection-Info: l41g2000cwc.googlegroups.com; posting-host=67.40.162.228; posting-account=C7LM4w0AAAD23IRuMuUUJVCLQTuHhTK8 Original-Xref: shelby.stanford.edu gnu.emacs.help:128703 Original-To: help-gnu-emacs@gnu.org 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 X-MailScanner-To: geh-help-gnu-emacs@m.gmane.org Xref: main.gmane.org gmane.emacs.help:24239 X-Report-Spam: http://spam.gmane.org/gmane.emacs.help:24239 > I want to bind the mouse-popup-menubar to a keyboard enent, > *not* to C-mouse-3 which is the default binding. When I try > > (global-set-key (kbd "M-") 'mouse-popup-menubar) > > for example, and then I press M- I get the message > > mouse-popup-menubar must be bound to an event with parameters > mouse-popup-menubar is defined with (interactive "@e \nP"). The `e' is an event from which it can determine the window, buffer, and screen position to associate the popup-menu with. In fact it's possible that different menus will display depending on what buffer you click in. It seems your best chance of clean operation is to write a function that makes up a contrived event list appropriate to your cursor position and uses it to call mouse-popup-menubar. It likely depends on your windowing software if keyboard completion of the popup is possible. On W32 systems it is. Between this function and the Emacs Lisp Reference manual you can probably find a way to create the appropriate event. (defun event-test (event) (interactive "@e") (message "Event = %s" event) ) (global-set-key [S-mouse-3] 'event-test) >>From what returned above I was able to get the menu to pop up. See below. Looks promising. The word `keyboard' was made up. The above said S-mouse-3 like you'd expect. M-: (mouse-popup-menubar `(keyboard (,(selected-window) 248 (126 . 104) 70080603 nil 248 (15 . 6) nil (6 . 8) (8 . 16))) ()) P.S. The final () in the above call is the `P' prefix arg. Your keyboard function should grab this and pass it along to be complete. Good luck. If you invent something useful please post.