From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Ergus Newsgroups: gmane.emacs.devel Subject: Re: New Context Menu Date: Thu, 19 Aug 2021 15:57:01 +0200 Message-ID: <20210819135701.ygypxl7asl4edwbp@Ergus> References: <20210818120834.i3orh535tb2enpos.ref@Ergus> <20210818120834.i3orh535tb2enpos@Ergus> <87r1epzznt.fsf@mail.linkov.net> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="33000"; mail-complaints-to="usenet@ciao.gmane.io" Cc: emacs-devel@gnu.org To: Juri Linkov Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Thu Aug 19 15:59:04 2021 Return-path: Envelope-to: ged-emacs-devel@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 1mGiZU-0008TF-0h for ged-emacs-devel@m.gmane-mx.org; Thu, 19 Aug 2021 15:59:04 +0200 Original-Received: from localhost ([::1]:44804 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mGiZS-0004RR-43 for ged-emacs-devel@m.gmane-mx.org; Thu, 19 Aug 2021 09:59:02 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:48020) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mGiY1-00025m-3R for emacs-devel@gnu.org; Thu, 19 Aug 2021 09:57:33 -0400 Original-Received: from sonic311-13.consmr.mail.bf2.yahoo.com ([74.6.131.123]:40254) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mGiXx-0002iv-6S for emacs-devel@gnu.org; Thu, 19 Aug 2021 09:57:31 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aol.com; s=a2048; t=1629381446; bh=uHNNFVWBohQlzKFrYgZJ6mrjEa+rI1WQ5mzeYevwdwY=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From:Subject:Reply-To; b=o71zc6/yxLd0U1KmsyOJPzFpf4EFu/DDDUnbf7B8QR57MdXPNYAvmAiptwawH+ZR81cQkwoog+FkXULySmtGDyTWncV2uuQmjRn+idnJeJMNMfprsexpuLanng31ry4yLCBlVozziKqwI5wcoKkX3HnoxRoHr5gyigey7z5fd09p4bbWATTKkUK7bwFqQfgiasInl0en3ybnod15YJmKiq9LYeyavhgGZUZQhgsLdSp6F/Eh1Wv6dk2DCAH4AAxvoGnuEvNk0sKOR5xCJ5iLlsnI/pxiVhPx+iZkQsJK5SHadnyDhH0mc2nXRuxwGLCzOok+X8V3jjYIjnE7onzVoA== X-SONIC-DKIM-SIGN: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1629381446; bh=V1sT1IOiyFmN3kb4ULQQX1/iEOlmqBoci4lPUNQ1p4r=; h=X-Sonic-MF:Date:From:To:Subject:From:Subject; b=AcNORCNgFZ4sw7AeSuP3AEcJJUj8vsc3eCqYN42+oXHO4esPOoVwxU9W9jyspY0hlA9GnEnAcZpDFjhX3jyJFZP2E5CFHQ6Vs0vXehJFfK4BX/4uFh/57DDXR/4PD/TG/EWYPS7xjXDK1/x+UY/kb2L2Dn3HOwYrK9H3W3DyoPWgj64Q3K4c5SeL69Jyh6ca1EkB5tuteHB+/ET7rNwXrysvNDi22cMR2m+LPpEx2Bs3QK8M9Msc7VT7BULXa2BOoZtxgTSW0cAMYzcmYG5Z0KEQokUXnbfNZPnCaguwi3zk2ZLBoSpKqixAPQ686IR19/JhPeQoUlmu3PPTd39INw== X-YMail-OSG: b9RDVrYVM1lAE8z7kk2FXRrJQLeJ3aCPV.vGDRDgvh5CMREZuhHD746FfhABGj5 6UQaMPUhCl0wmbsDlYbxc4VdyvvbTie3D.7f_OvHu89uTDdjGzTBO2BNszQgdvMsb0fyAh2hMWfG XxcCrAKuhk5D9wyzjEyMcbP9gXrc5xupIcW0Qz7y.TdJx2alPSRUG6jHQYBcL1mng34tnQYf4faj VQIMDQPfhKjfaAZwo1.9_khMRYy3CVYkSqvzcenQOLTZ0zxgBGXi28IOGQqTQCVM5JHqkw1DNDxC YM1G55rzT2JR6fv904UYY7W2xw_rv4bf69gyEv1XQqoJOSdTZOcp3kdeNKWlBpcHIKiKtYs41b5m .BKk.iavK190h_ohsZYb5CGSFF_a62088sCNckUIMkcprdaQ_H0ImaTBpJfFUgCFi1s7Yx1lJxUK tZOj_iIfelCUT90aYvX.Mw3WkupbsWbSvkRyu1Jrzft5ZZm1QIidUwnXDTVGvh9jgPoQromyNqZ2 KizmqNlZ9iyvXyLF1IrT9tXi.sEjNf7TPJEZrJpcJ6JMOl_nVoUmpw1rviOZayjLD9IWAJj34txS 4vvkgmA.Zq2NEhzuXTHopg_2K7b7eEA3EpXXYx0_8rwY.RkLupZu2w26NCfwcAggCbU2IPCgyF12 PCRfWjDsk6W9pw5g1yblmJco9MEq7YNE.EdOVno_KA8ZMeKwgzP_90gYJq2H92H40OLCVDZS3WWm D.v4v6xlqoU8c1SjRAfrLHem7IM0DD..WmeCwJdc8L_1.FR6b3asPSZWvcxSoq.cO8qeABQ9F_4l j7VV2m42DB3siJWkEN1Larl0LWksNb28NsiHV_1Qbh X-Sonic-MF: Original-Received: from sonic.gate.mail.ne1.yahoo.com by sonic311.consmr.mail.bf2.yahoo.com with HTTP; Thu, 19 Aug 2021 13:57:26 +0000 Original-Received: by kubenode538.mail-prod1.omega.ir2.yahoo.com (VZM Hermes SMTP Server) with ESMTPA ID 6089e22fa7abdb60f36756d428a469c9; Thu, 19 Aug 2021 13:57:23 +0000 (UTC) Content-Disposition: inline In-Reply-To: <87r1epzznt.fsf@mail.linkov.net> X-Mailer: WebService/1.1.18850 mail.backend.jedi.jws.acl:role.jedi.acl.token.atz.jws.hermes.aol Received-SPF: pass client-ip=74.6.131.123; envelope-from=spacibba@aol.com; helo=sonic311-13.consmr.mail.bf2.yahoo.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:272668 Archived-At: On Thu, Aug 19, 2021 at 10:01:10AM +0300, Juri Linkov wrote: >> The current implementation follows the X11 menu interaction pattern: >> Hold mouse-3 to keep the menu active and release mouse-3 to select an >> entry. >> >> Could we add an option to avoid this and have the same interaction >> behavior than in gui please?: mouse-3 activates the menu, a click over >> an option selects it and a click outside the menu hides the menu > >When you press down-mouse-1 and immediately release the mouse button, >it has the same effect as if you clicked mouse-1: it displays the menu >without selecting a menu item. So with the current win-win situation >both scenarios are supported: > >1. one click: down-mouse-1, select a menu item, release mouse-1; >2. two clicks: click mouse-1, select a menu item by clicking mouse-1 again. > > >Both ways work on xterm as well - you can easily select a menu item with >one click on xterm too. > Hi Juri: For me only 1. works now as you describe on xterm. Whenever I try 2. it doesn't work the menu disappears when I release the button either fast or slow. With the problem that releasing fast usually selects the first item (generally Undo). On gui it works as you describe. Maybe this is something deeper related with the menu API, I don't know... >> In case the user wants to bind the context menu without using the mouse >> how can be done? Will the context-menu appear in the current cursor >> (point) or in the current mouse arrow position? > >This is possible, but the menu appears at the left top corner, >as for example it appears on typing 'C-' that runs the command >buffer-menu-open. Here is its implementation: > > (defun buffer-menu-open () > "Start key navigation of the buffer menu. > This is the keyboard interface to \\[mouse-buffer-menu]." > (interactive) > (popup-menu (mouse-buffer-menu-keymap) > (posn-at-x-y 0 0 nil t))) > >We could do the same with: > > (popup-menu (context-menu-map) > (posn-at-x-y 0 0 nil t)) > >Or do it much better: > > (popup-menu (context-menu-map) > (point)) > >What would a good key to bind such command? Maybe 'S-'? > There is the menu key that nobody seems to use because since 2007 nobody noticed that it is not bound for xterm. Everywhere else (browsers, editors, explorers) the menu key has the same effect than right click, so if we want a binding, this is the right one. Sadly execute-extended-command is bound to [menu]; but the user may know that when context-menu is enabled, that binding is replaced for something standard... (or add a custom to set it). I just started another thread about [menu] not bound in xterm. >But please note that currently when you select a menu item >using the keyboard, many commands will fail with > > (error "Command must be bound to an event with parameters") > The dirty but functional solution for this may be to create a function/macro that emulates a full event. Because I don't know how difficult may be to modify the events api to distinguish when the mouse was used or use the point otherwise...