emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

emacs-28 02853ed: Fix sorting of menus in `context-menu-local' (bug#5006


From: Juri Linkov
Subject: emacs-28 02853ed: Fix sorting of menus in `context-menu-local' (bug#50067).
Date: Thu, 18 Nov 2021 13:37:12 -0500 (EST)

branch: emacs-28
commit 02853edba795b0d47201977d3b500e8a46ed5e0f
Author: Juri Linkov <juri@linkov.net>
Commit: Juri Linkov <juri@linkov.net>

    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'.
---
 lisp/menu-bar.el | 2 +-
 lisp/mouse.el    | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/lisp/menu-bar.el b/lisp/menu-bar.el
index f19dc9e..da79aae 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 b6448a1..0a4ab28 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)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]