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: Fri, 20 Aug 2021 14:21:26 +0200 Message-ID: <20210820122126.tp6zna2ei2n5wrbw@Ergus> References: <20210818120834.i3orh535tb2enpos.ref@Ergus> <20210818120834.i3orh535tb2enpos@Ergus> <87r1epzznt.fsf@mail.linkov.net> <20210819135701.ygypxl7asl4edwbp@Ergus> <87eeaoio3v.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="12933"; mail-complaints-to="usenet@ciao.gmane.io" Cc: emacs-devel@gnu.org, Stefan Monnier To: Juri Linkov Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Fri Aug 20 14:23:47 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 1mH3Yo-00039z-Qa for ged-emacs-devel@m.gmane-mx.org; Fri, 20 Aug 2021 14:23:46 +0200 Original-Received: from localhost ([::1]:37444 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mH3Ym-0002Om-RA for ged-emacs-devel@m.gmane-mx.org; Fri, 20 Aug 2021 08:23:44 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:40016) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mH3X2-0001ZO-Db for emacs-devel@gnu.org; Fri, 20 Aug 2021 08:21:57 -0400 Original-Received: from sonic310-13.consmr.mail.bf2.yahoo.com ([74.6.135.123]:43027) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mH3Wz-0002Pm-Ek for emacs-devel@gnu.org; Fri, 20 Aug 2021 08:21:55 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aol.com; s=a2048; t=1629462110; bh=i8FZLeFjsJSxolrZ38Ct3OZ2gEEKZHWMlkiEAOONjc0=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From:Subject:Reply-To; b=UsRJgI1bFSE5ZYIeGiusA9SikqYjJfJhgDXN2t4rlSlWTTuafBW84jnBe7NPT0b2bCnWSaMy+gKhqzMODnOPU2VzLTK/yHRdlB3t5m7jHejUBG78CiJYspH0EJ+kH2mR6axxMaSPP+tog7n3u8h1kL2mFo8/MtozBYtP1jZaFAu7rp0z9rTsZnnSEPjxFga8UWMBwjx94sY2T3BI7Fl1Wec4xMAW3EhNjnWi3jW+g8IibWZ1DA/jQZ52XpgOyE6PZqbYJGiqErDfzjsdTO2y/lFCulW70CBjDS4uvfavDzV18sq5SwbP8ax2BxgTtzKqo8tXIA8JkUYCl0W88IXCgw== X-SONIC-DKIM-SIGN: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1629462110; bh=v+EdOtubHsANLAI6aFAc/5A0u849ChAvnZ0w6QqhiYV=; h=X-Sonic-MF:Date:From:To:Subject:From:Subject; b=hTmYiYnBEVykKCoyeO6WU8/UWpcDYFJB0MlJEa4Ph9A3WcC9Ml2jBKq/ybPSp9r6n0xog9YlVNndHCMfP+XrfnsRynONG6C8YHwCtzgIhPmx3dEmoVXEkfFcxdbeuSWf78beMZmwamO7fogMyH87RbpyMGNIx5i1lxd7DXtLQ/RN606J7uOaCkd+O720bVWEkGVienL2HB0H8rsld9obHgYpQ1bVzSeHJshUp/ddouHspAovDlvO6Sao7xxhgRceiMaJkZ4rc/vVX6TAvMMRUcJlQLBi4pzEhB5dVnWSWkXlevFk9wxNeofe4Sx8OOS01EvJRClIL7si5rzSBRb7bA== X-YMail-OSG: aeoOHWMVM1mmNLfgJnGycsXJWFsuNpBCbOpnE2mHjCxaHi3DNVHLdEOVPjFJKoj 00OYzI3EY8eutjLsrvcedSoswOaNGH2coZY9In75zIhl1yxbniY_lGU8VFo.3UkfgHK_.1eTCvdS UPzY7D58T6JzaG_l3SL2i0yM177_xHL.HVxbaTJi2BPaxse8fFm27f0z0HszjXjOUFB_DE35v6zM GmTO1cv_TleboisbUVFrZJdW3eGvlJmMj5WU8aR5jYu_rsGpYx7qGHdfTnnLYq35dm.zsv0wB3Tc 9cDNz3SMsN_9Iu0H6HHOPFWtAeXN85qqLwcy.XRMYXolg1mTtXfrAMJiInAjvRJkvDsh.hurt4vS 2AEfpt1CONuuoc59qXRTvj4Y.dxyWY7qrOj5RDtjQVV0axjVpjMQIzuHBpbrs_1d1lrTyCfAzgMo PaeEP9TekzZdkKl.kNr8SnJ8L_Ev0YsoliRfi8Ulmo5TWtWgXg77NFFuYNQqKw4Z1fsgPFqApf_h xZWp6_9LH7qzkFLr4xzZxmuu.JRJPcEUwLcda32DtAwYJ3.i8d5kQiIZKhK5PvP9bWpa1k9Fmm4e pHjOU4MHd4Kf0oP3bS7mWJa6z6lbPVag.PiGj3MSH_gtPneKsZHaCfi1uLvmEkiePQneofEi9ky. .buGpum_.wqkvJdivHNVqplwEYeN.iRTAsVqQdS4ZpNAVP.dgB27IVPlSZ4ff6CGWKwQAiHnwkRI OMzXXFF81a0Fak4LmP.ZCgHmEjt5NP5FYqrL4ZcgXEB5WnHGlwhE9rfFvX9GkEl.sQZb4N6nmkad 4gkGKIgDnglVG9gMuU3rQDL8AM_I3Iby6awaUttB_6 X-Sonic-MF: Original-Received: from sonic.gate.mail.ne1.yahoo.com by sonic310.consmr.mail.bf2.yahoo.com with HTTP; Fri, 20 Aug 2021 12:21:50 +0000 Original-Received: by kubenode510.mail-prod1.omega.ir2.yahoo.com (VZM Hermes SMTP Server) with ESMTPA ID df6dbde54ed5651ab0173cdb05310057; Fri, 20 Aug 2021 12:21:48 +0000 (UTC) Content-Disposition: inline In-Reply-To: <87eeaoio3v.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.135.123; envelope-from=spacibba@aol.com; helo=sonic310-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:272713 Archived-At: On Fri, Aug 20, 2021 at 10:24:00AM +0300, Juri Linkov wrote: >>>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. >> >> 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). > >Do other menus work for you? What do you see when clicking >C- bound to mouse-buffer-menu, or S- >bound to mouse-appearance-menu, or C- bound to >mouse-menu-bar-map, etc. > C- and C- Behave as you describe. S- Does not work in xterm The issue is that context menu is bound to an "unmodified" mouse event. If you try this on xterm: (global-set-key [down-mouse-1] 'mouse-buffer-menu) or (global-set-key [down-mouse-3] 'mouse-buffer-menu) Then you should notice the same issue. Or when I press C- (shows the menu), then release control, and after that, release the mouse button: same behavior (menu disappears and/or selects). So emacs is receiving the "up-mouse-1" as an event in xterm. That's the issue. >> 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). > >Does this patch work for you? If yes, then we could create >context-menu-mode-map active for context-menu-mode >and add these keybindings to it. > >diff --git a/lisp/mouse.el b/lisp/mouse.el >index d2a5200d8d..ecf95f11b5 100644 >--- a/lisp/mouse.el >+++ b/lisp/mouse.el >@@ -454,8 +455,13 @@ context-menu-mode > (setq context-menu--old-mouse-3 (global-key-binding [mouse-3])) > (global-unset-key [mouse-3]) > (setq context-menu--old-down-mouse-3 (global-key-binding [down-mouse-3])) >- (global-set-key [down-mouse-3] context-menu-entry)) >+ (global-set-key [down-mouse-3] context-menu-entry) >+ (setq context-menu--old-menu (global-key-binding [menu])) >+ (global-set-key [menu] context-menu-entry)) > (t >+ (when context-menu--old-menu >+ (global-set-key [menu] context-menu--old-menu) >+ (setq context-menu--old-menu nil)) > (if (not context-menu--old-down-mouse-3) > (global-unset-key [down-mouse-3]) > (global-set-key [down-mouse-3] context-menu--old-down-mouse-3) We need to fix the [menu] issue in xterm first, because right now there is no [menu] key action. But I haven't receive any reply about that in the other thread; so I don't know if it is actually an issue or a design choice. Hopefully Stefan (who added the commit in 2007) will reply about this. Just a question: If the context-menu-mode is a minor mode. Why the bindings are not added in a context-menu-mode-map and avoids manually saving the -old commands? Is there an issue with that?