From: john@ankarstrom.se (John Ankarström)
To: Jean-Christophe Helary <jean.christophe.helary@gmail.com>
Cc: help-gnu-emacs@gnu.org
Subject: Re: F10 → menu
Date: Sun, 28 May 2017 16:33:45 +0200 [thread overview]
Message-ID: <87poetrqye.fsf@ankarstrom.se> (raw)
In-Reply-To: <874139F0-9A0A-4726-813D-C0EAD9BBEBF7@gmail.com> (Jean-Christophe Helary's message of "Sun, 28 May 2017 22:55:13 +0900")
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
next prev parent reply other threads:[~2017-05-28 14:33 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-05-25 3:11 F10 → menu Jean-Christophe Helary
2017-05-25 5:25 ` Alexis
2017-05-25 5:42 ` Jean-Christophe Helary
2017-05-25 5:54 ` Alexis
2017-05-25 15:05 ` Eli Zaretskii
2017-05-28 10:02 ` Jean-Christophe Helary
2017-05-28 11:46 ` John Ankarström
2017-05-28 12:50 ` Jean-Christophe Helary
2017-05-28 12:57 ` Jean-Christophe Helary
2017-05-28 13:24 ` John Ankarström
2017-05-28 13:55 ` Jean-Christophe Helary
2017-05-28 14:33 ` John Ankarström [this message]
2017-05-28 14:42 ` Jean-Christophe Helary
2017-05-28 14:54 ` John Ankarström
2017-05-28 15:00 ` Jean-Christophe Helary
2017-05-28 15:18 ` John Ankarström
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87poetrqye.fsf@ankarstrom.se \
--to=john@ankarstrom.se \
--cc=help-gnu-emacs@gnu.org \
--cc=jean.christophe.helary@gmail.com \
/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.
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.