unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: "rgb" <rbielaws@i1.net>
Subject: Re: How to bind pop up menu to a key?
Date: 21 Feb 2005 22:16:30 -0800	[thread overview]
Message-ID: <1109052990.467199.86400@l41g2000cwc.googlegroups.com> (raw)
In-Reply-To: mailman.969.1109039160.32256.help-gnu-emacs@gnu.org

> 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-<f1>") 'mouse-popup-menubar)
>
> for example, and then I press M-<F1> 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))) ()) <ret>

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.

  parent reply	other threads:[~2005-02-22  6:16 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-02-21  1:45 How to bind pop up menu to a key? Neon Absentius
2005-02-21 20:56 ` August
2005-02-22  2:05   ` Neon Absentius
     [not found]   ` <mailman.969.1109039160.32256.help-gnu-emacs@gnu.org>
2005-02-22  6:16     ` rgb [this message]
2005-02-26 10:06       ` Neon Absentius

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1109052990.467199.86400@l41g2000cwc.googlegroups.com \
    --to=rbielaws@i1.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).