Fix sorting of menus in `context-menu-local' (bug#50067).

* lisp/menu-bar.el (menu-bar-keymap): Don't use `lookup-key'
on the `keymap' arg.

* lisp/mouse.el (context-menu-global): Use `lookup-key global-map'
for the `keymap' arg of `menu-bar-keymap'.
(context-menu-local): Use `menu-bar-keymap' to sort `keymap'.
This commit is contained in:
Juri Linkov 2021-11-18 20:36:55 +02:00
parent 14271d050a
commit 02853edba7
2 changed files with 3 additions and 3 deletions

View file

@ -2715,7 +2715,7 @@ could provide `global-map' where items are limited to the global map only."
;; sorting.
(push (cons pos menu-item) menu-end)
(push menu-item menu-bar))))
(lookup-key (or keymap (menu-bar-current-active-maps)) [menu-bar]))
(or keymap (lookup-key (menu-bar-current-active-maps) [menu-bar])))
`(keymap ,@(nreverse menu-bar)
,@(mapcar #'cdr (sort menu-end
(lambda (a b)

View file

@ -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))))
(menu-bar-keymap global-map))
(menu-bar-keymap (lookup-key global-map [menu-bar])))
menu)
(defun context-menu-local (menu _click)
@ -377,7 +377,7 @@ Some context functions add menu items below the separator."
(when (consp binding)
(define-key-after menu (vector key)
(copy-sequence binding))))
keymap)))
(menu-bar-keymap keymap))))
menu)
(defun context-menu-minor (menu _click)