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, 18 Aug 2021 19:42:12 +0300 Organization: LINKOV.NET Message-ID: <87v942pvcj.fsf@mail.linkov.net> References: <74BC00E9-2509-47DA-9428-1523FF7F3B33@acm.org> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="17066"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (x86_64-pc-linux-gnu) Cc: 50067@debbugs.gnu.org, Tak Kunihiro , tkk@misasa.okayama-u.ac.jp, Lars Ingebrigtsen , Alan Third To: Mattias =?UTF-8?Q?Engdeg=C3=A5rd?= Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Wed Aug 18 18:49:03 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 1mGOkR-0004Jg-Ca for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 18 Aug 2021 18:49:03 +0200 Original-Received: from localhost ([::1]:60568 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mGOkQ-0005wD-2w for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 18 Aug 2021 12:49:02 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:40644) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mGOhW-0007lD-45 for bug-gnu-emacs@gnu.org; Wed, 18 Aug 2021 12:46:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:45903) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mGOhV-0005CB-NF for bug-gnu-emacs@gnu.org; Wed, 18 Aug 2021 12:46:01 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1mGOhV-0002AB-L6 for bug-gnu-emacs@gnu.org; Wed, 18 Aug 2021 12:46: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, 18 Aug 2021 16:46: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.16293051118227 (code B ref 50067); Wed, 18 Aug 2021 16:46:01 +0000 Original-Received: (at 50067) by debbugs.gnu.org; 18 Aug 2021 16:45:11 +0000 Original-Received: from localhost ([127.0.0.1]:57444 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mGOgh-00028Y-31 for submit@debbugs.gnu.org; Wed, 18 Aug 2021 12:45:11 -0400 Original-Received: from relay2-d.mail.gandi.net ([217.70.183.194]:44383) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mGOgb-00027E-Aq for 50067@debbugs.gnu.org; Wed, 18 Aug 2021 12:45:06 -0400 Original-Received: (Authenticated sender: juri@linkov.net) by relay2-d.mail.gandi.net (Postfix) with ESMTPSA id B346040009; Wed, 18 Aug 2021 16:44:54 +0000 (UTC) In-Reply-To: <74BC00E9-2509-47DA-9428-1523FF7F3B33@acm.org> ("Mattias =?UTF-8?Q?Engdeg=C3=A5rd?="'s message of "Wed, 18 Aug 2021 12:52:08 +0200") 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:212160 Archived-At: > 1. Mac users expect C-mouse-1 to be equivalent to mouse-3 because Macs > traditionally only have one mouse button; this is especially true of laptop > users (probably the majority today). Simply speaking, control-mouse-1 is > expected to invoke the context menu; this is the platform convention and we > should try to find a way to make it so. > > We could add a mac-only setting that remaps control-mouse-1 to mouse-3 > (preserving all other modifiers like shift, alt and super). (I don't think > there already is such a translation but could be mistaken). I'm attaching > a tentative patch as a proof of concept. > > It is also possible to just do it in Lisp, but then we'd probably need > to do it specially for the context menu. (I tried using event > translation but that didn't work right.) The raison d'être for the special mode context-menu-mode is to rebind the default keys optionally. So it would make sense to bind context-menu-entry conditionally: 1. to [C-mouse-1] on macOS depending on ‘(featurep 'ns)’; 2. to [down-mouse-3] everywhere else. in the function body of context-menu-mode. > Currently, C-mouse-1 pops up the buffer menu but it's unclear if > that's used by a sizeable part of the population, and in any case Macs > have a Buffer menu easily accessible in the menu bar. Additionally, a Buffer menu is accessible from the context menu when context-menu-functions is customized to contain ‘context-menu-global’. > 2. The context menu contains the disabled entry "Context Menu" as some kind > of title – that is very alien on macOS where context menus never have > titles. I believe the same is true at least on Windows, and frankly, there > should be no need to explicitly tell the user that what he or she is > looking at is a context menu. I suggest we just drop the title on > all platforms. > > Replacing (purecopy "Context Menu") by "" in `context-menu-entry` makes it > go away, but then we get the new title "Select" from heavens knows where > (menu.c, from the look of it). Apparently the Emacs menu system just wants > a title; we should find a way to disable it in popup menus. After trying to remove it altogether, there is no title at all, but maybe it's platform-dependent (I tested on GTK): diff --git a/lisp/mouse.el b/lisp/mouse.el index 9b7d4c240f..5193994231 100644 --- a/lisp/mouse.el +++ b/lisp/mouse.el @@ -304,7 +304,7 @@ context-menu-filter-function (defun context-menu-map () "Return composite menu map." - (let ((menu (make-sparse-keymap "Context Menu"))) + (let ((menu (make-sparse-keymap))) (run-hook-wrapped 'context-menu-functions (lambda (fun) (setq menu (funcall fun menu)) > 3. Not Mac-specific (really about xref): in some modes, Find Definition > applies to point instead of where the click occurred. Apparently the xref > backend ignores the symbol discovered by xref-find-definition-at-mouse > because that tokenisation isn't appropriate for the language and it does > a more thorough job that is based on point instead. What we really should > do is to set point temporarily for the whole duration of the > xref-find-definitions call. Could you please provide a test case? Because I've thoroughly tested “Find Definition” to apply where the click occurred, and it works as expected.