From: Juri Linkov Date: Thu, 18 Nov 2021 18:36:55 +0000 (+0200) Subject: Fix sorting of menus in `context-menu-local' (bug#50067). X-Git-Tag: emacs-28.0.90~57 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=02853edba795b0d47201977d3b500e8a46ed5e0f;p=emacs.git 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'. --- diff --git a/lisp/menu-bar.el b/lisp/menu-bar.el index f19dc9e7c97..da79aae5295 100644 --- a/lisp/menu-bar.el +++ b/lisp/menu-bar.el @@ -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) diff --git a/lisp/mouse.el b/lisp/mouse.el index b6448a13f3a..0a4ab2878ab 100644 --- a/lisp/mouse.el +++ b/lisp/mouse.el @@ -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)