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: Mon, 08 Nov 2021 22:05:12 +0200 Organization: LINKOV.NET Message-ID: <864k8mwgzr.fsf@mail.linkov.net> References: <87pmufb3u0.fsf@mail.linkov.net> <875ytr1vkp.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="20659"; 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 Mon Nov 08 21:08:20 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 1mkAwG-0005EX-70 for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 08 Nov 2021 21:08:20 +0100 Original-Received: from localhost ([::1]:57902 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mkAwE-0000AQ-Qc for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 08 Nov 2021 15:08:18 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:45340) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mkAvy-000099-Vj for bug-gnu-emacs@gnu.org; Mon, 08 Nov 2021 15:08:02 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:48101) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mkAvy-0005DT-JZ for bug-gnu-emacs@gnu.org; Mon, 08 Nov 2021 15:08:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1mkAvy-0006j9-Cx for bug-gnu-emacs@gnu.org; Mon, 08 Nov 2021 15:08:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Juri Linkov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 08 Nov 2021 20:08:02 +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.163640202525780 (code B ref 50067); Mon, 08 Nov 2021 20:08:02 +0000 Original-Received: (at 50067) by debbugs.gnu.org; 8 Nov 2021 20:07:05 +0000 Original-Received: from localhost ([127.0.0.1]:59647 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mkAv2-0006hk-Mk for submit@debbugs.gnu.org; Mon, 08 Nov 2021 15:07:04 -0500 Original-Received: from relay10.mail.gandi.net ([217.70.178.230]:56101) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mkAuz-0006hC-Gz for 50067@debbugs.gnu.org; Mon, 08 Nov 2021 15:07:02 -0500 Original-Received: (Authenticated sender: juri@linkov.net) by relay10.mail.gandi.net (Postfix) with ESMTPSA id 87184240006 for <50067@debbugs.gnu.org>; Mon, 8 Nov 2021 20:06:54 +0000 (UTC) In-Reply-To: <875ytr1vkp.fsf@mail.linkov.net> (Juri Linkov's message of "Wed, 20 Oct 2021 19:59:18 +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:219379 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: Actually, here is a better patch that will also allow sorting items on context-menu-local as well. The same KEYMAP arg of menu-bar-keymap could be used also in mouse-menu-bar-map to sort items of [C-down-mouse-3] in the right order (they were unsorted for a long time): --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=menu-bar-keymap-2.patch diff --git a/lisp/menu-bar.el b/lisp/menu-bar.el index 1a81f1a3d0..94e75efeeb 100644 --- a/lisp/menu-bar.el +++ b/lisp/menu-bar.el @@ -2738,7 +2738,7 @@ menu-bar-keymap ;; 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 d6912892ef..5b9ae121d7 100644 --- a/lisp/mouse.el +++ b/lisp/mouse.el @@ -271,10 +271,10 @@ mouse-menu-bar-map ;; FIXME: We have a problem here: we have to use the global/local/minor ;; so they're displayed in the expected order, but later on in the command ;; loop, they're actually looked up in the opposite order. - (apply 'append - global-menu - local-menu - minor-mode-menus))) + (menu-bar-keymap (apply 'append + global-menu + local-menu + minor-mode-menus)))) ;; Context menus. @@ -364,7 +364,7 @@ context-menu-global (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 @@ context-menu-local (when (consp binding) (define-key-after menu (vector key) (copy-sequence binding)))) - keymap))) + (menu-bar-keymap keymap)))) menu) (defun context-menu-minor (menu _click) --=-=-=--