[Top][All Lists]

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

Re: New Context Menu

From: Juri Linkov
Subject: Re: New Context Menu
Date: Thu, 19 Aug 2021 10:01:10 +0300
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (x86_64-pc-linux-gnu)

> The current implementation follows the X11 menu interaction pattern:
> Hold mouse-3 to keep the menu active and release mouse-3 to select an
> entry.
> Could we add an option to avoid this and have the same interaction
> behavior than in gui please?: mouse-3 activates the menu, a click over
> an option selects it and a click outside the menu hides the menu

When you press down-mouse-1 and immediately release the mouse button,
it has the same effect as if you clicked mouse-1: it displays the menu
without selecting a menu item.  So with the current win-win situation
both scenarios are supported:

1. one click: down-mouse-1, select a menu item, release mouse-1;
2. two clicks: click mouse-1, select a menu item by clicking mouse-1 again.

Both ways work on xterm as well - you can easily select a menu item with
one click on xterm too.

> In case the user wants to bind the context menu without using the mouse
> how can be done? Will the context-menu appear in the current cursor
> (point) or in the current mouse arrow position?

This is possible, but the menu appears at the left top corner,
as for example it appears on typing 'C-<f10>' that runs the command
buffer-menu-open.  Here is its implementation:

  (defun buffer-menu-open ()
    "Start key navigation of the buffer menu.
  This is the keyboard interface to \\[mouse-buffer-menu]."
    (popup-menu (mouse-buffer-menu-keymap)
                (posn-at-x-y 0 0 nil t)))

We could do the same with:

    (popup-menu (context-menu-map)
                (posn-at-x-y 0 0 nil t))

Or do it much better:

    (popup-menu (context-menu-map)

What would a good key to bind such command?  Maybe 'S-<f10>'?

But please note that currently when you select a menu item
using the keyboard, many commands will fail with

  (error "Command must be bound to an event with parameters")

reply via email to

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