]> git.eshelyaron.com Git - emacs.git/commitdiff
* lisp/mouse.el (context-menu-open): New command bound to [S-f10].
authorJuri Linkov <juri@linkov.net>
Mon, 23 Aug 2021 17:42:16 +0000 (20:42 +0300)
committerJuri Linkov <juri@linkov.net>
Mon, 23 Aug 2021 17:42:16 +0000 (20:42 +0300)
* doc/emacs/frames.texi (Menu Mouse Clicks): Mention S-F10
to pop up the context menu.

* src/callint.c (Fcall_interactively):
Use inhibit_mouse_event_check for the case 'e'.
(inhibit-mouse-event-check): New variable.

https://lists.gnu.org/archive/html/emacs-devel/2021-08/msg00733.html

doc/emacs/frames.texi
etc/NEWS
lisp/mouse.el
src/callint.c

index d582d24e766b80e48ef61cd5256d8b19798ce7eb..22f22efacac03bf00f679ce0490ed923a114816c 100644 (file)
@@ -370,6 +370,7 @@ This menu is for changing the default face within the window's buffer.
 @findex context-menu-mode
 @vindex context-menu-functions
 @kindex Down-mouse-3
+@kindex S-F10
   Many GUI applications use @kbd{mouse-3} to display @dfn{context
 menus}: menus that provide access to various pertinent settings and
 actions for the location and context of the mouse click.  If you
@@ -382,6 +383,7 @@ mode and the buffer contents around the place where you click the
 mouse.  To customize the contents of the context menu, you can use the
 variable @code{context-menu-functions} (@pxref{Major Mode
 Conventions,,, elisp, The Emacs Lisp Reference Manual}).
+You can also invoke the context menu by pressing @kbd{S-@key{F10}}.
 
 @node Mode Line Mouse
 @section Mode Line Mouse Commands
index b008c46291c0fafa0d7cb61fc6b62a96758da654..ed77443dbf03df30a568fa8ea4b73a390c367454 100644 (file)
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -398,6 +398,7 @@ When this mode is enabled, clicking 'down-mouse-3' anywhere in the buffer
 pops up a menu whose contents depends on surrounding context near the
 mouse click.  You can change the order of the default sub-menus in the
 context menu by customizing the user option 'context-menu-functions'.
+You can also invoke the context menu by pressing 'S-<F10>'.
 
 +++
 *** The "Edit => Clear" menu item now obeys a rectangular region.
@@ -3845,6 +3846,12 @@ to match the behaviour.)
 When non-nil, matches for identifiers in the file visited by the
 current buffer will be shown first in the "*xref*" buffer.
 
+---
+** New variable 'inhibit-mouse-event-check'.
+If bound to non-nil, a command with '(interactive "e")'
+doesn't signal an error when no mouse event is produced
+while using the keyboard.
+
 \f
 * Changes in Emacs 28.1 on Non-Free Operating Systems
 
index 28996e373d9d76a1744be7fdcb782094891fd88a..9d86681384836cfc8b75e47893fab5d89cb24245 100644 (file)
@@ -469,6 +469,15 @@ When Context Menu mode is enabled, clicking the mouse button down-mouse-3
 activates the menu whose contents depends on its surrounding context."
   :global t :group 'mouse)
 
+(defun context-menu-open ()
+  "Start key navigation of the context menu.
+This is the keyboard interface to \\[context-menu-map]."
+  (interactive)
+  (let ((inhibit-mouse-event-check t))
+    (popup-menu (context-menu-map) (point))))
+
+(global-set-key [S-f10] 'context-menu-open)
+
 \f
 ;; Commands that operate on windows.
 
index 6f8a7f13f61d544ca450794ace99801dbd0a46fe..5201dc7ba1617c3cc29aa9b14de0f574def6ffd1 100644 (file)
@@ -606,7 +606,7 @@ invoke it (via an `interactive' spec that contains, for instance, an
          break;
 
        case 'e':               /* The invoking event.  */
-         if (next_event >= key_count)
+         if (!inhibit_mouse_event_check && next_event >= key_count)
            error ("%s must be bound to an event with parameters",
                   (SYMBOLP (function)
                    ? SSDATA (SYMBOL_NAME (function))
@@ -900,6 +900,13 @@ Its purpose is to give temporary modes such as Isearch mode
 a way to turn themselves off when a mouse command switches windows.  */);
   Vmouse_leave_buffer_hook = Qnil;
 
+  DEFVAR_BOOL ("inhibit-mouse-event-check", inhibit_mouse_event_check,
+    doc: /* Non-nil means the interactive spec "e" doesn't check for events.
+In this case `(interactive "e")' doesn't signal an error when no mouse event
+is produced while using the keyboard.  Then `event-start', `event-end',
+`event-click-count' can create a new event.  */);
+  inhibit_mouse_event_check = false;
+
   defsubr (&Sinteractive);
   defsubr (&Scall_interactively);
   defsubr (&Sfuncall_interactively);