help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Pop up context menu (at point) with <menu> key rather than mouse


From: N. Jackson
Subject: Re: Pop up context menu (at point) with <menu> key rather than mouse
Date: Sat, 10 Nov 2018 12:50:30 -0500
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux)

At 00:27 +0700 on Sunday 2018-11-11, Yuri Khan wrote:
>
> On Sun, Nov 11, 2018 at 12:11 AM N. Jackson <nljlistbox2@gmail.com> wrote:
>
>> >   (global-set-key [C-down-mouse-3]
>> >     `(menu-item ,(purecopy "Menu Bar") ignore
>> >       :filter (lambda (_)
>> >               (if (zerop (or (frame-parameter nil 'menu-bar-lines) 0))
>> >                   (mouse-menu-bar-map)
>> >                 (mouse-menu-major-mode-map)))))
>>
>> Hmm... where is `menu-item' defined?
>
> See the ‘`’ character? That indicates that the following is a quoted
> list (except that the part prefixed with ‘,’ is not quoted. Anyway,
> that is a list whose first element is the symbol 'menu-item, and that
> list is passed to ‘global-set-key’.
>
> So you want to go look what ‘global-set-key’ does with that. You might
> know, or learn from the source, that ‘global-set-key’ is a wrapper
> function around ‘define-key’.

Thanks Yuri. This far I had already stumbled, although it's nice to see
it set out more crisply than the fuzzy version of it in my head!

> Then, C-h f define-key tells you its
> last argument can take a number of forms, none of which seem to match
> a list '(menu-item …), except possibly this:
>
>     DEF is anything that can be a key’s definition:
>     […]
>      or an extended menu item definition.
>      (See info node ‘(elisp)Extended Menu Items’.)

Aha! That info node (and those around it) are a wealth of useful
information!

Thanks.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]