mirror of
https://git.savannah.gnu.org/git/emacs.git
synced 2024-12-12 09:28:24 +00:00
* lisp/menu-bar.el (menu-bar-keymap): Add optional arg KEYMAP (bug#50067).
* lisp/mouse.el (context-menu-global): Use 'menu-bar-keymap' with its arg KEYMAP set to 'global-map'.
This commit is contained in:
parent
0545c70c16
commit
1cdb4d2077
@ -2696,10 +2696,13 @@ This command is to be used when you click the mouse in the menubar."
|
||||
(cdr menu-bar-item-cons)
|
||||
0))))
|
||||
|
||||
(defun menu-bar-keymap ()
|
||||
(defun menu-bar-keymap (&optional keymap)
|
||||
"Return the current menu-bar keymap.
|
||||
The ordering of the return value respects `menu-bar-final-items'.
|
||||
|
||||
The ordering of the return value respects `menu-bar-final-items'."
|
||||
It's possible to use the KEYMAP argument to override the default keymap
|
||||
that is the currently active maps. For example, the argument KEYMAP
|
||||
could provide `global-map' where items are limited to the global map only."
|
||||
(let ((menu-bar '())
|
||||
(menu-end '()))
|
||||
(map-keymap
|
||||
@ -2712,7 +2715,7 @@ The ordering of the return value respects `menu-bar-final-items'."
|
||||
;; sorting.
|
||||
(push (cons pos menu-item) menu-end)
|
||||
(push menu-item menu-bar))))
|
||||
(lookup-key (menu-bar-current-active-maps) [menu-bar]))
|
||||
(lookup-key (or keymap (menu-bar-current-active-maps)) [menu-bar]))
|
||||
`(keymap ,@(nreverse menu-bar)
|
||||
,@(mapcar #'cdr (sort menu-end
|
||||
(lambda (a b)
|
||||
|
@ -364,7 +364,7 @@ Some context functions add menu items below the separator."
|
||||
(when (consp binding)
|
||||
(define-key-after menu (vector key)
|
||||
(copy-sequence binding))))
|
||||
(lookup-key global-map [menu-bar]))
|
||||
(menu-bar-keymap global-map))
|
||||
menu)
|
||||
|
||||
(defun context-menu-local (menu _click)
|
||||
|
Loading…
Reference in New Issue
Block a user