GNU bug report logs -
#50067
Context menus
Previous Next
Reported by: Juri Linkov <juri <at> linkov.net>
Date: Sun, 15 Aug 2021 08:52:01 UTC
Severity: normal
Tags: fixed
Fixed in version 28.0.50
Done: Juri Linkov <juri <at> linkov.net>
Bug is archived. No further changes may be made.
Full log
Message #303 received at 50067 <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
Currently the option context-menu-global of context-menu-functions
doesn't take into account the variable menu-bar-final-items
to properly order the menu items. This patch makes it possible
to order the items of global-map instead of menu-bar-current-active-maps
used in menu-bar-keymap by default:
[menu-bar-keymap.patch (text/x-diff, inline)]
diff --git a/lisp/menu-bar.el b/lisp/menu-bar.el
index 980ba2fcd1..b6cc29720d 100644
--- a/lisp/menu-bar.el
+++ b/lisp/menu-bar.el
@@ -2713,9 +2713,11 @@ menu-bar-open-mouse
(cdr menu-bar-item-cons)
0))))
-(defun menu-bar-keymap ()
+(defun menu-bar-keymap (&optional keymap)
"Return the current menu-bar keymap.
-
+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.
The ordering of the return value respects `menu-bar-final-items'."
(let ((menu-bar '())
(menu-end '()))
@@ -2729,7 +2731,7 @@ menu-bar-keymap
;; 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)
diff --git a/lisp/mouse.el b/lisp/mouse.el
index 3e00ca7ce1..6c97cc365f 100644
--- a/lisp/mouse.el
+++ b/lisp/mouse.el
@@ -364,7 +364,7 @@ context-menu-global
(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)
This bug report was last modified 3 years and 172 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.