all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* How to bind pop up menu to a key?
@ 2005-02-21  1:45 Neon Absentius
  2005-02-21 20:56 ` August
  0 siblings, 1 reply; 5+ messages in thread
From: Neon Absentius @ 2005-02-21  1:45 UTC (permalink / raw)


Hello

I like to turn the menu bar off since most of the time I don't use
it. However now and then --especially when I am trying a new
package-- I like to use the menu for easy reference. When I am in 
X I prefer to use the C-mouse3 binding that pop's up a nice menu with
the contents of the menu bar. I hate to leave the keyboard to reach
for the rodent though. Is there some way to bind this to a key? 

Also is it possible to navigate the pop-up menus with the keyboard?

-- 
Charity in capitalism is like urinating to extinguish a forest fire.
    -- Neon Absentius
absent a.in.cirle sdf period lonestar period org
SDF Public Access UNIX System - http://sdf.lonestar.org

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: How to bind pop up menu to a key?
  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>
  0 siblings, 2 replies; 5+ messages in thread
From: August @ 2005-02-21 20:56 UTC (permalink / raw)


On mån, 2005-02-21 at 01:45 +0000, Neon Absentius wrote:
> Hello
> 
> I like to turn the menu bar off since most of the time I don't use
> it. However now and then --especially when I am trying a new
> package-- I like to use the menu for easy reference. When I am in 
> X I prefer to use the C-mouse3 binding that pop's up a nice menu with
> the contents of the menu bar. I hate to leave the keyboard to reach
> for the rodent though. Is there some way to bind this to a key? 

(menu-bar-mode nil)
(global-set-key [C-mouse-3] 'mouse-popup-menubar)

> Also is it possible to navigate the pop-up menus with the keyboard?

Don't know. If you use C-mouse-3 for the menu then you already have your
hand on the mouse, so why use the keyboard?

-- 
August

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: How to bind pop up menu to a key?
  2005-02-21 20:56 ` August
@ 2005-02-22  2:05   ` Neon Absentius
       [not found]   ` <mailman.969.1109039160.32256.help-gnu-emacs@gnu.org>
  1 sibling, 0 replies; 5+ messages in thread
From: Neon Absentius @ 2005-02-22  2:05 UTC (permalink / raw)


On Mon, Feb 21, 2005 at 09:56:58PM +0100, August wrote:
> On mΓ₯n, 2005-02-21 at 01:45 +0000, Neon Absentius wrote:
> > Hello
> > 
> > I like to turn the menu bar off since most of the time I don't use
> > it. However now and then --especially when I am trying a new
> > package-- I like to use the menu for easy reference. When I am in 
> > X I prefer to use the C-mouse3 binding that pop's up a nice menu with
> > the contents of the menu bar. I hate to leave the keyboard to reach
> > for the rodent though. Is there some way to bind this to a key? 
> 
> (menu-bar-mode nil)
> (global-set-key [C-mouse-3] 'mouse-popup-menubar)

Thanks for your answer. I am afraid I didn't express my self very
clearly. 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

The mouse-popup-menubar seems to be the right action since when I unbind 
the [C-mouse-3] and then rebind it again it works as before.


> 
> > Also is it possible to navigate the pop-up menus with the keyboard?
> 
> Don't know. If you use C-mouse-3 for the menu then you already have your
> hand on the mouse, so why use the keyboard?
> 

Yes, but I want to have the popup menu from the keyboard to begin
with.

-- 
Charity in capitalism is like urinating to extinguish a forest fire.
    -- Neon Absentius
absent a.in.cirle sdf period lonestar period org
SDF Public Access UNIX System - http://sdf.lonestar.org

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: How to bind pop up menu to a key?
       [not found]   ` <mailman.969.1109039160.32256.help-gnu-emacs@gnu.org>
@ 2005-02-22  6:16     ` rgb
  2005-02-26 10:06       ` Neon Absentius
  0 siblings, 1 reply; 5+ messages in thread
From: rgb @ 2005-02-22  6:16 UTC (permalink / raw)


> 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.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: How to bind pop up menu to a key?
  2005-02-22  6:16     ` rgb
@ 2005-02-26 10:06       ` Neon Absentius
  0 siblings, 0 replies; 5+ messages in thread
From: Neon Absentius @ 2005-02-26 10:06 UTC (permalink / raw)


On Mon, Feb 21, 2005 at 10:16:30PM -0800, rgb wrote:
 > 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>
> 

Thank you, this was very useful. 

I haven't had to time to pay any serious attention to this, but today
I played little bit bit with it and it looks promising.

If anything comes out of it I'll post.

-- 
Charity in capitalism is like urinating to extinguish a forest fire.
    -- Neon Absentius
absent a.in.cirle sdf period lonestar period org
SDF Public Access UNIX System - http://sdf.lonestar.org

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2005-02-26 10:06 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
2005-02-26 10:06       ` Neon Absentius

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.