@xref{Text Scale}.
@end table
+@cindex context menu
+@findex context-menu-mode
+@vindex context-menu-functions
+@kindex Down-mouse-3
Some graphical applications use @kbd{mouse-3} for a mode-specific
-menu. If you prefer @kbd{mouse-3} in Emacs to bring up such a menu
-instead of running the @code{mouse-save-then-kill} command, rebind
-@kbd{mouse-3} by adding the following line to your init file
-(@pxref{Init Rebinding}):
-
-@smallexample
-(global-set-key [mouse-3]
- '(menu-item "Menu Bar" ignore
- :filter (lambda (_)
- (if (zerop (or (frame-parameter nil 'menu-bar-lines) 0))
- (mouse-menu-bar-map)
- (mouse-menu-major-mode-map)))))
-@end smallexample
+menu. If you prefer @kbd{mouse-3} in Emacs to bring up such a context
+menu instead of running the @code{mouse-save-then-kill} command,
+enable @code{context-menu-mode} and customize the variable
+@code{context-menu-functions}.
@node Mode Line Mouse
@section Mode Line Mouse Commands
terminals, where this makes one additional line available for text.
If the menu bar is off, you can still pop up a menu of its contents
with @kbd{C-mouse-3} on a display which supports pop-up menus.
-@xref{Menu Mouse Clicks}.
+Or you can enable @code{context-menu-mode} and customize the variable
+@code{context-menu-functions} to pop up a context menu with
+@kbd{mouse-3}. @xref{Menu Mouse Clicks}.
@xref{Menu Bar}, for information on how to invoke commands with the
menu bar. @xref{X Resources}, for how to customize the menu bar
+++
** A prefix arg now causes 'delete-other-frames' to only iconify frames.
+** Menus
+
++++
+*** New mode 'context-menu-mode' for a context menu bound to 'mouse-3'.
+When this mode is enabled, clicking 'down-mouse-3' anywhere in the buffer
+pops up a context menu whose contents depends on surrounding context
+near the mouse click. You can customize the order of the default submenus
+in the context menu by customizing the user option 'context-menu-functions'.
+
+++
-** The "Edit => Clear" menu item now obeys a rectangular region.
+*** The "Edit => Clear" menu item now obeys a rectangular region.
+++
** New command 'execute-extended-command-for-buffer'.
"List of functions that produce the contents of the context menu.
Each function receives the menu as its argument and should return
the same menu with changes such as added new menu items."
- :type 'hook
- :options '(context-menu-undo
- context-menu-region
- context-menu-global
- context-menu-local
- context-menu-minor
- context-menu-vc
- context-menu-ffap)
+ :type '(repeat
+ (choice (function-item context-menu-undo)
+ (function-item context-menu-region)
+ (function-item context-menu-global)
+ (function-item context-menu-local)
+ (function-item context-menu-minor)
+ (function-item context-menu-vc)
+ (function-item context-menu-ffap)
+ (function :tag "Custom function")))
:version "28.1")
(defcustom context-menu-filter-function nil
menu)
(defun context-menu-minor (menu)
- "Minor mode submenus."
+ "Minor modes submenus."
(run-hooks 'activate-menubar-hook 'menu-bar-update-hook)
(define-key-after menu [separator-minor] menu-bar-separator)
(dolist (mode (minor-mode-key-binding [menu-bar]))
menu)
(defun context-menu-undo (menu)
+ "Undo menu."
(when (cddr menu)
(define-key-after menu [separator-undo] menu-bar-separator))
(define-key-after menu [undo]
menu)
(defun context-menu-region (menu)
+ "Region commands menu."
(when (cddr menu)
(define-key-after menu [separator-region] menu-bar-separator))
(define-key-after menu [cut]
menu)
(defun context-menu-ffap (menu)
+ "File at point menu."
(save-excursion
(mouse-set-point last-input-event)
(when (ffap-guess-file-name-at-point)