[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: F10 → menu
From: |
John Ankarström |
Subject: |
Re: F10 → menu |
Date: |
Sun, 28 May 2017 16:33:45 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/25.1 (gnu/linux) |
Jean-Christophe Helary <jean.christophe.helary@gmail.com> writes:
>> On May 28, 2017, at 22:24, John Ankarström <john@ankarstrom.se> wrote:
>
>> I looked at the documentation for `x-popup-menu':
>>
>>> Pop up a deck-of-cards menu and return user’s selection.
>>
>> <C-f2>, as defined above, would only return the user's
>> selection without executing it. For example, when selecting
>> Help > Emacs Tutorial, the following is returned:
>>
>>> (help-menu emacs-tutorial)
>>
>> I'm not sure on how you'd go about executing that, but I'm
>> sure there's a way.
>
> Ok, I feel better :) I just need to investigate that, it's not
> a problem with my system...
I took a look at the source for `x-menu-bar-open', which is the
function called by `menu-bar-open' (<C-down-mouse-3>):
--8<---------------cut here---------------start------------->8---
(defun x-menu-bar-open (&optional frame)
"Open the menu bar if it is shown.
`popup-menu' is used if it is off."
(interactive "i")
(cond
((and (not (zerop (or (frame-parameter nil 'menu-bar-lines) 0)))
(fboundp 'accelerate-menu))
(accelerate-menu frame))
(t
(popup-menu (mouse-menu-bar-map) last-nonmenu-event))))
--8<---------------cut here---------------end--------------->8---
It calls `popup-menu', which seems to do the pretty much the same
thing as `x-popup-menu', but instead of just returning the
selected item, it executes it:
> Popup the given menu and call the selected option.
Thus, to achieve the functionality you want (which seems to be
opening the menu in the top-left corner of the window?), the
following function would do it:
--8<---------------cut here---------------start------------->8---
(defun menu-bar-open-top-left ()
(interactive)
(popup-menu (mouse-menu-bar-map) (list '(0 0) (selected-frame))))
(global-set-key (kbd "<C-f2>") #'menu-bar-open-top-left)
--8<---------------cut here---------------end--------------->8---
Hope that works for you.
- John
- F10 → menu, Jean-Christophe Helary, 2017/05/24
- Re: F10 → menu, Alexis, 2017/05/25
- Re: F10 → menu, Eli Zaretskii, 2017/05/25
- Re: F10 → menu, Jean-Christophe Helary, 2017/05/28
- Re: F10 → menu, Jean-Christophe Helary, 2017/05/28
- Re: F10 → menu, John Ankarström, 2017/05/28
- Re: F10 → menu, Jean-Christophe Helary, 2017/05/28
- Re: F10 → menu,
John Ankarström <=
- Re: F10 → menu, Jean-Christophe Helary, 2017/05/28
- Re: F10 → menu, John Ankarström, 2017/05/28
- Re: F10 → menu, Jean-Christophe Helary, 2017/05/28
- Re: F10 → menu, John Ankarström, 2017/05/28
- Re: F10 → menu, John Ankarström, 2017/05/28
- Re: F10 → menu, Jean-Christophe Helary, 2017/05/28