mirror of
https://github.com/masscollaborationlabs/emacs.git
synced 2025-07-06 04:09:37 +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
2 changed files with 7 additions and 4 deletions
|
@ -2696,10 +2696,13 @@ This command is to be used when you click the mouse in the menubar."
|
||||||
(cdr menu-bar-item-cons)
|
(cdr menu-bar-item-cons)
|
||||||
0))))
|
0))))
|
||||||
|
|
||||||
(defun menu-bar-keymap ()
|
(defun menu-bar-keymap (&optional keymap)
|
||||||
"Return the current menu-bar 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 '())
|
(let ((menu-bar '())
|
||||||
(menu-end '()))
|
(menu-end '()))
|
||||||
(map-keymap
|
(map-keymap
|
||||||
|
@ -2712,7 +2715,7 @@ The ordering of the return value respects `menu-bar-final-items'."
|
||||||
;; sorting.
|
;; sorting.
|
||||||
(push (cons pos menu-item) menu-end)
|
(push (cons pos menu-item) menu-end)
|
||||||
(push menu-item menu-bar))))
|
(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)
|
`(keymap ,@(nreverse menu-bar)
|
||||||
,@(mapcar #'cdr (sort menu-end
|
,@(mapcar #'cdr (sort menu-end
|
||||||
(lambda (a b)
|
(lambda (a b)
|
||||||
|
|
|
@ -364,7 +364,7 @@ Some context functions add menu items below the separator."
|
||||||
(when (consp binding)
|
(when (consp binding)
|
||||||
(define-key-after menu (vector key)
|
(define-key-after menu (vector key)
|
||||||
(copy-sequence binding))))
|
(copy-sequence binding))))
|
||||||
(lookup-key global-map [menu-bar]))
|
(menu-bar-keymap global-map))
|
||||||
menu)
|
menu)
|
||||||
|
|
||||||
(defun context-menu-local (menu _click)
|
(defun context-menu-local (menu _click)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue