From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel Subject: Re: Context menus and mouse-3 [was: Changes for emacs 28] Date: Tue, 15 Sep 2020 09:11:20 -0400 Message-ID: References: <20200914061111.3trmuzhdvv7nwdcc@Ergus> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="37106"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) Cc: spacibba@aol.com, philipk@posteo.net, emacs-devel@gnu.org, arthur.miller@live.com, dgutov@yandex.ru, ghe@sdf.org, drew.adams@oracle.com To: Richard Stallman Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Tue Sep 15 15:17:15 2020 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 1kIApe-0009VE-Cp for ged-emacs-devel@m.gmane-mx.org; Tue, 15 Sep 2020 15:17:14 +0200 Original-Received: from localhost ([::1]:59738 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kIApd-00055g-Cd for ged-emacs-devel@m.gmane-mx.org; Tue, 15 Sep 2020 09:17:13 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:36102) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kIAk4-0006EZ-GI for emacs-devel@gnu.org; Tue, 15 Sep 2020 09:11:28 -0400 Original-Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:10356) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kIAk1-00085g-QD; Tue, 15 Sep 2020 09:11:27 -0400 Original-Received: from pmg1.iro.umontreal.ca (localhost.localdomain [127.0.0.1]) by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id BC183100227; Tue, 15 Sep 2020 09:11:23 -0400 (EDT) Original-Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id D2FFD1001CB; Tue, 15 Sep 2020 09:11:21 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1600175481; bh=Rgx6iCloBubAwXUASwl7btyhDPBzjB8fEROlh/78ie4=; h=From:To:Cc:Subject:References:Date:In-Reply-To:From; b=Ot51SwHZuq9yldSoMkC1rnW+RaIDSltNZLGB2I9h3ZegNj98m/EqA8uUGltTyTJnF Tldk9B6+M59GtpU/Yx1Cg74XxTKynkAeGLKCGlUIIPXZI2ZLi5gbXrSyM4b/2uL/yx nle+AJBk9suOAMS2N9liazICizLJvU1ARB4sa/lyD5j6Lj0oex5ihzT3wqjz8mDyQZ raHNLYWq/xANeR+cCLzAEKPzkXcZxVVKp2J+IHWhH/wJ4faWa5jr7BJ9FmxPLJc8Pi fCM2mmKDKdxqbt84JgXsYI636Hm+X+/QBA4mgTHl6z+LqOfzdT/SjYGBNojkbgqREr +mLLwOQYOf7tA== Original-Received: from alfajor (unknown [45.72.232.131]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 39B4C12064C; Tue, 15 Sep 2020 09:11:21 -0400 (EDT) In-Reply-To: (Richard Stallman's message of "Tue, 15 Sep 2020 00:35:58 -0400") Received-SPF: pass client-ip=132.204.25.50; envelope-from=monnier@iro.umontreal.ca; helo=mailscanner.iro.umontreal.ca X-detected-operating-system: by eggs.gnu.org: First seen = 2020/09/15 09:11:24 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] X-Spam_score_int: -42 X-Spam_score: -4.3 X-Spam_bar: ---- X-Spam_report: (-4.3 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, RCVD_IN_DNSWL_MED=-2.3, 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:255740 Archived-At: Richard Stallman [2020-09-15 00:35:58] wrote: > [[[ To any NSA and FBI agents reading my email: please consider ]]] > [[[ whether defending the US Constitution against all enemies, ]]] > [[[ foreign or domestic, requires you to follow Snowden's example. ]]] > > > We don't need to choose, since we can get a context menu on > > `down-mouse-3` and 'mouse-save-then-kill' on `mouse-3`. > > Have you tried doing that? How does it work in practice? Here's the code I'm using: (let ((default-context-menu `(menu-item ,(purecopy "Menu Bar") ignore :filter (lambda (_) (if (zerop (or (frame-parameter nil 'menu-bar-lines) 0)) (mouse-menu-bar-map) (mouse-menu-major-mode-map)))))) (global-set-key [C-down-mouse-3] default-context-menu) (global-set-key [context-menu] default-context-menu)) (global-set-key [down-mouse-3] #'mouse-maybe-context-menu) (defun mouse-maybe-context-menu (event) "Bring up a context menu for a long click. See `mouse-long-click-time' and `mouse-context-menu-function'." (interactive "@e") (if (let ((track-mouse t)) (sit-for (/ mouse-long-click-time 1000.0))) (push (cons 'context-menu (cdr event)) unread-command-events))) It's not good enough for `master` (IIRC the sit-for tends to return nil immediately in some circumstances), but I didn't pursue this any further given the lack of interest at the time. I can't think of any reason why it should be hard to fix. Stefan