[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Context menus and mouse-3
From: |
Juri Linkov |
Subject: |
Re: Context menus and mouse-3 |
Date: |
Tue, 13 Jul 2021 02:56:27 +0300 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (x86_64-pc-linux-gnu) |
>> The global binding of [menu-bar] is defined in menu-bar.el,
>> so the same way [context-menu] could be defined globally
>
> Agreed, and I think it would address the above problem.
> I.e. do something like
>
> (defun mouse-context-menu (event)
> (push `(context-menu . ,(cdr event)) unread-command-events))
OT1H, this avoids an explicit call to 'popup-menu'. But OTOH,
this precludes constructing the context-menu with a user-defined
function mouse-context-menu-function.
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.
> PS: FWIW, the "proof of concept" code I have in my local Emacs is:
[...]
> I think `sit-for` can be made to work OK, but my proof-of-concept
> isn't good enough. I think the main issue is that it doesn't
> swallow the mouse-3 click, but I haven't really looked into it.
At least, now we have two implementations, and both could be improved
before selecting the one that works better. Meanwhile, I'd continue
trying to combine [context-menu] with mouse-context-menu-function.
- Re: Context menus and mouse-3, (continued)
- Re: Context menus and mouse-3, Juri Linkov, 2021/07/20
- Re: Context menus and mouse-3, Tak Kunihiro, 2021/07/21
- RE: [External] : Re: Context menus and mouse-3, Drew Adams, 2021/07/21
- Re: Context menus and mouse-3, Stefan Monnier, 2021/07/21
- RE: [External] : Re: Context menus and mouse-3, Drew Adams, 2021/07/21
- Re: Context menus and mouse-3, Tak Kunihiro, 2021/07/21
- RE: [External] : Re: Context menus and mouse-3, Drew Adams, 2021/07/22
- Re: Context menus and mouse-3, Ergus, 2021/07/19
- Re: Context menus and mouse-3, Juri Linkov, 2021/07/20
Re: Context menus and mouse-3, Stefan Monnier, 2021/07/12
- Re: Context menus and mouse-3,
Juri Linkov <=
- 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, 2021/07/13
- 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