From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Juri Linkov Newsgroups: gmane.emacs.bugs Subject: bug#50067: Context menus Date: Wed, 20 Oct 2021 19:59:18 +0300 Message-ID: <875ytr1vkp.fsf@mail.linkov.net> References: <87pmufb3u0.fsf@mail.linkov.net> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="23494"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (x86_64-pc-linux-gnu) To: 50067@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Wed Oct 20 19:01:53 2021 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mdEyP-0005yE-81 for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 20 Oct 2021 19:01:53 +0200 Original-Received: from localhost ([::1]:47870 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mdEyN-0001zg-RP for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 20 Oct 2021 13:01:51 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:57680) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mdExa-0001z4-Je for bug-gnu-emacs@gnu.org; Wed, 20 Oct 2021 13:01:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:43818) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mdExa-0008Jw-2a for bug-gnu-emacs@gnu.org; Wed, 20 Oct 2021 13:01:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1mdExZ-000075-VV for bug-gnu-emacs@gnu.org; Wed, 20 Oct 2021 13:01:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Juri Linkov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 20 Oct 2021 17:01:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 50067 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: fixed Original-Received: via spool by 50067-submit@debbugs.gnu.org id=B50067.163474922730911 (code B ref 50067); Wed, 20 Oct 2021 17:01:01 +0000 Original-Received: (at 50067) by debbugs.gnu.org; 20 Oct 2021 17:00:27 +0000 Original-Received: from localhost ([127.0.0.1]:55364 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mdEx1-00082E-87 for submit@debbugs.gnu.org; Wed, 20 Oct 2021 13:00:27 -0400 Original-Received: from relay7-d.mail.gandi.net ([217.70.183.200]:54187) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mdEx0-0007v9-1A for 50067@debbugs.gnu.org; Wed, 20 Oct 2021 13:00:26 -0400 Original-Received: (Authenticated sender: juri@linkov.net) by relay7-d.mail.gandi.net (Postfix) with ESMTPSA id 139732000B for <50067@debbugs.gnu.org>; Wed, 20 Oct 2021 17:00:18 +0000 (UTC) In-Reply-To: <87pmufb3u0.fsf@mail.linkov.net> (Juri Linkov's message of "Sun, 15 Aug 2021 11:48:55 +0300") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:217696 Archived-At: --=-=-= Content-Type: text/plain 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: --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=menu-bar-keymap.patch 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) --=-=-=--