emacs-devel
[Top][All Lists]
Advanced

[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: Fri, 20 Aug 2021 10:24:00 +0300
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (x86_64-pc-linux-gnu)

>>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.
>
> For me only 1. works now as you describe on xterm.
>
> Whenever I try 2. it doesn't work the menu disappears when I release the
> button either fast or slow. With the problem that releasing fast usually
> selects the first item (generally Undo).

Do other menus work for you?  What do you see when clicking
C-<down-mouse-1> bound to mouse-buffer-menu, or S-<down-mouse-1>
bound to mouse-appearance-menu, or C-<down-mouse-3> bound to
mouse-menu-bar-map, etc.

> There is the menu key that nobody seems to use because since 2007 nobody
> noticed that it is not bound for xterm. Everywhere else (browsers,
> editors, explorers) the menu key has the same effect than right click,
> so if we want a binding, this is the right one. Sadly
> execute-extended-command is bound to [menu]; but the user may know that
> when context-menu is enabled, that binding is replaced for something
> standard... (or add a custom to set it).

Does this patch work for you?  If yes, then we could create
context-menu-mode-map active for context-menu-mode
and add these keybindings to it.

diff --git a/lisp/mouse.el b/lisp/mouse.el
index d2a5200d8d..ecf95f11b5 100644
--- a/lisp/mouse.el
+++ b/lisp/mouse.el
@@ -454,8 +455,13 @@ context-menu-mode
     (setq context-menu--old-mouse-3 (global-key-binding [mouse-3]))
     (global-unset-key [mouse-3])
     (setq context-menu--old-down-mouse-3 (global-key-binding [down-mouse-3]))
-    (global-set-key [down-mouse-3] context-menu-entry))
+    (global-set-key [down-mouse-3] context-menu-entry)
+    (setq context-menu--old-menu (global-key-binding [menu]))
+    (global-set-key [menu] context-menu-entry))
    (t
+    (when context-menu--old-menu
+      (global-set-key [menu] context-menu--old-menu)
+      (setq context-menu--old-menu nil))
     (if (not context-menu--old-down-mouse-3)
         (global-unset-key [down-mouse-3])
       (global-set-key [down-mouse-3] context-menu--old-down-mouse-3)



reply via email to

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