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.devel Subject: Re: New Context Menu and mouse-1 Date: Sat, 28 Aug 2021 21:52:57 +0300 Organization: LINKOV.NET Message-ID: <874kb9mlhj.fsf@mail.linkov.net> References: <20210818120834.i3orh535tb2enpos.ref@Ergus> <20210818120834.i3orh535tb2enpos@Ergus> <87tujb77vq.fsf_-_@mail.linkov.net> <83y28nqsuv.fsf@gnu.org> <87bl5ig6qk.fsf@mail.linkov.net> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="19146"; 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: Eli Zaretskii , emacs-devel@gnu.org To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sat Aug 28 21:17:59 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 1mK3q2-0004ic-Rf for ged-emacs-devel@m.gmane-mx.org; Sat, 28 Aug 2021 21:17:58 +0200 Original-Received: from localhost ([::1]:36416 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mK3q0-0007ZG-MP for ged-emacs-devel@m.gmane-mx.org; Sat, 28 Aug 2021 15:17:56 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:40226) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mK3pU-0006tp-Ou for emacs-devel@gnu.org; Sat, 28 Aug 2021 15:17:24 -0400 Original-Received: from relay1-d.mail.gandi.net ([217.70.183.193]:56005) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mK3pS-0005Yy-Eh; Sat, 28 Aug 2021 15:17:24 -0400 Original-Received: (Authenticated sender: juri@linkov.net) by relay1-d.mail.gandi.net (Postfix) with ESMTPSA id 6C0E5240002; Sat, 28 Aug 2021 19:17:13 +0000 (UTC) In-Reply-To: (Stefan Monnier's message of "Fri, 27 Aug 2021 18:01:54 -0400") Received-SPF: pass client-ip=217.70.183.193; envelope-from=juri@linkov.net; helo=relay1-d.mail.gandi.net X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=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:273349 Archived-At: >> - (deactivate-mark) >> - (pop-mark))))) > > Note that this changes conceptually what `mouse-drag-track` does. > Instead of only giving visual feedback during a drag, it actually does > select the region (whereas in the current code, the region selection is > actually performed by the binding of `drag-mouse-1` to `mouse-set-region`). > > So the above will lead to `mouse-set-region` being called when the > region has already been set (at least in terminals that provide > `mouse-movement` events). > > I'm not sure if it can introduce problems, but it would deserve > a comment about the fact that the region selection is performed > "redundantly" here and in `mouse-set-region` and why it's done this way. With more testing I noticed that after pushing the mark twice it requires more C-u C-SPC to get back to the original mark. Maybe push-mark could be optimized to not push the mark to the same position that is already at the top of the mark-ring. Hmm, interesting that it intentionally let-binds history-delete-duplicates to nil. > From what I remember about the last time I worked in this code, it's > a somewhat messy area. Indeed, this code looks overcomplicated. I tried to implement extending the existing region with S-mouse-1 based on existing code, but this is not a simple task due to code complexity. > BTW, maybe another way to look at the problem is to say that > invoking the context-menu should not exit the transient map (but this > may come with its own set of problems, of course). > > Related to this, I wonder if `down-mouse-1` .. move .. `down-mouse-3`, > `up-mouse-3` ... `up-mouse-1` would and/or should generate > a `drag-mouse-1` event. Actually, the existing event sequence without the final `drag-mouse-1` is exactly what is needed, because `drag-mouse-1` is intended to finalize the region selection, but there may be nothing to select at this time after `up-mouse-3` invoked "Cut" or "Clear" from the context menu.