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: New Context Menu and mouse-1 Date: Fri, 27 Aug 2021 18:01:54 -0400 Message-ID: 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="29941"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) Cc: Eli Zaretskii , emacs-devel@gnu.org To: Juri Linkov Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sat Aug 28 00:03:08 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 1mJjwK-0007UA-FP for ged-emacs-devel@m.gmane-mx.org; Sat, 28 Aug 2021 00:03:08 +0200 Original-Received: from localhost ([::1]:54022 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mJjwI-0002ys-R7 for ged-emacs-devel@m.gmane-mx.org; Fri, 27 Aug 2021 18:03:06 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:38564) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mJjvH-0002I4-NH for emacs-devel@gnu.org; Fri, 27 Aug 2021 18:02:04 -0400 Original-Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:60800) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mJjvD-0006Bt-BJ; Fri, 27 Aug 2021 18:02:01 -0400 Original-Received: from pmg1.iro.umontreal.ca (localhost.localdomain [127.0.0.1]) by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id E24261001EE; Fri, 27 Aug 2021 18:01:56 -0400 (EDT) Original-Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id 75EF61001F4; Fri, 27 Aug 2021 18:01:55 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1630101715; bh=iC8aEWBJuzciPZFVrizGgMz9WeQyEtc0ydKGoGm+yKQ=; h=From:To:Cc:Subject:References:Date:In-Reply-To:From; b=GHHReLt36ygwxUDfo+brQWZXtMUECZ27/XO8c2XycBQhCXKV8t2qDf+FjFRh1GaZ+ tDy4Yee+BSLPDboI+Ps/ESfGHWcT+0jVa5V+HMFdJCtASdKGe+zoO+4UYQWiH0PNLm CmVhlKN+DMk6D7OEm23IGITMYEpLcsxzMEBXDfUyW3jH6nnz/wN1cjLcs0o2rMhJ3Y eOx3i6FG1xe8+7eVlfDZgL3UBTsgXnUMHsfyZ2h+9rp/n/2tVddzuctAal0ZtWqTlA vmn6pM7E/K/3PbR0dAPF5mVWpPGdpKapZ99DiKe1zEa8eFoN7KknY+OFQnHBG200eJ aoT1zHShMaHqQ== Original-Received: from alfajor (unknown [104.247.244.135]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 30D821202A0; Fri, 27 Aug 2021 18:01:55 -0400 (EDT) In-Reply-To: <87bl5ig6qk.fsf@mail.linkov.net> (Juri Linkov's message of "Fri, 27 Aug 2021 20:03:31 +0300") Received-SPF: pass client-ip=132.204.25.50; envelope-from=monnier@iro.umontreal.ca; helo=mailscanner.iro.umontreal.ca 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:273192 Archived-At: > diff --git a/lisp/mouse.el b/lisp/mouse.el > index 7d3ed9a0e4..933ad5181e 100644 > --- a/lisp/mouse.el > +++ b/lisp/mouse.el > @@ -1578,9 +1578,7 @@ mouse-drag-track > map) > t (lambda () > (setq track-mouse old-track-mouse) > - (setq auto-hscroll-mode auto-hscroll-mode-saved) > - (deactivate-mark) > - (pop-mark))))) > + (setq auto-hscroll-mode auto-hscroll-mode-saved))))) > > (defun mouse--drag-set-mark-and-point (start click click-count) > (let* ((range (mouse-start-end start click click-count)) > > Then everything works fine: the aforementioned case > and the normal using mouse-1 to select a region. 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. >From what I remember about the last time I worked in this code, it's a somewhat messy area. 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. Stefan