[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Context menus and mouse-3
From: |
Stefan Monnier |
Subject: |
Re: Context menus and mouse-3 |
Date: |
Tue, 13 Jul 2021 22:14:08 -0400 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) |
>>> I tried to override the global [context-menu] with e.g. menu-bar-custom-menu
>>> (that later could be replaced with the value returned from
>>> mouse-context-menu-function):
>>>
>>> (let ((map (make-sparse-keymap)))
>>> (define-key map [context-menu] menu-bar-custom-menu)
>>> (set-transient-map map))
>>> (push (cons 'context-menu (cdr event)) unread-command-events)
>>>
>>> However, it doesn't override the global [context-menu], but prepends
>>> the transient [context-menu] before the global one.
>>
>> Yes, if the key is bound in various keymaps and all the bindings are to
>> a keymap, then those keymaps get merged, as usual for prefix keymaps.
>>
>> Two ways to solve that:
>> - use `mouse-context-menu-function` instead of adding a new local
>> key binding for `context-menu`.
>> - don't bind `context-menu` to a keymap but to a command (that
>> presumably then uses `popup-menu` internally).
>
> `popup-menu` has the same problems: it doesn't run post/pre-command-hook, etc.
That doesn't matter: the command loop does that for us before/after calling
the command bound to `context-menu`, so the command bound to
`context-menu` doesn't need to do it. The problem with your original
call is not the use of `popup-menu` but the fact that it runs it from
from a timer.
Stefan
Re: Context menus and mouse-3, Stefan Monnier, 2021/07/12
- Re: Context menus and mouse-3, Juri Linkov, 2021/07/12
- Re: Context menus and mouse-3, Stefan Monnier, 2021/07/12
- Re: Context menus and mouse-3, Juri Linkov, 2021/07/13
- Re: Context menus and mouse-3,
Stefan Monnier <=
- Re: Context menus and mouse-3, Juri Linkov, 2021/07/14
- Re: Context menus and mouse-3, Stefan Monnier, 2021/07/14
- Re: Context menus and mouse-3, Juri Linkov, 2021/07/15
- Re: Context menus and mouse-3, Stefan Monnier, 2021/07/16
- Re: Context menus and mouse-3, Juri Linkov, 2021/07/16
- Re: Context menus and mouse-3, Stefan Monnier, 2021/07/16
Re: Context menus and mouse-3, Eli Zaretskii, 2021/07/15
Re: Context menus and mouse-3, Juri Linkov, 2021/07/15
Re: Context menus and mouse-3, Eli Zaretskii, 2021/07/16
Re: Context menus and mouse-3, Juri Linkov, 2021/07/16