From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: "tomas@tuxteam.de" Newsgroups: gmane.emacs.devel Subject: Re: [External] : Re: Fix for `use-region-p' problem [was: Elisp test for whether `mouse-1' is pressed?] Date: Tue, 9 Nov 2021 12:29:03 +0100 Message-ID: <20211109112903.GC13092@tuxteam.de> References: <20211108082814.GA4971@tuxteam.de> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="Md/poaVZ8hnGTzuv" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="322"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mutt/1.5.21 (2010-09-15) Cc: "emacs-devel@gnu.org" To: Drew Adams Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Tue Nov 09 12:30:19 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 1mkPKT-000AOC-D2 for ged-emacs-devel@m.gmane-mx.org; Tue, 09 Nov 2021 12:30:17 +0100 Original-Received: from localhost ([::1]:54402 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mkPKR-0002ze-Vi for ged-emacs-devel@m.gmane-mx.org; Tue, 09 Nov 2021 06:30:16 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:51884) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mkPJU-0002IB-Nf for emacs-devel@gnu.org; Tue, 09 Nov 2021 06:29:16 -0500 Original-Received: from mail.tuxteam.de ([5.199.139.25]:39304) by eggs.gnu.org with esmtps (TLS1.2:DHE_RSA_AES_128_CBC_SHA1:128) (Exim 4.90_1) (envelope-from ) id 1mkPJR-0007mN-Tp for emacs-devel@gnu.org; Tue, 09 Nov 2021 06:29:16 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=tuxteam.de; s=mail; h=In-Reply-To:Content-Type:MIME-Version:References:Message-ID:Subject:Cc:To:From:Date; bh=+oUJGjz5hR7rB103H7xL45kqaMTgNiLLadBFjm+7Lk8=; b=ClLnxqPPCb1XheS3Eyk6CrKCJxcdLa9IUGzeRtIG0s//upt+9eHrfWLSuj8R7xCwpMvBID+SPdyml37QHZTyfIzgU58xaWjRQA6tIX5W3p4UPTk9EXCvAqxysmE4BhHFvp8agebIlP4iQrfxJUVnz6kzPfO6FhEql3h9gv2IkbGNtC6NhfHSEgQZmrcB9f28IVzbS+aD2MyPSwERAi1I1IdbK0MGfB8tvAQQnyPlz/KvExuIHEHUwsGZVv+IUMohtTnjElSv0YEFy06/Y39dx7vmtFDFgG23rRbDcUf4v382Q0Bb/5Wj8yWuws/HQM7DYGHd4GbQNUIj/gQUeIbgfQ==; Original-Received: from tomas by mail.tuxteam.de with local (Exim 4.80) (envelope-from ) id 1mkPJH-0004s7-Iq; Tue, 09 Nov 2021 12:29:03 +0100 Content-Disposition: inline In-Reply-To: Received-SPF: pass client-ip=5.199.139.25; envelope-from=tomas@tuxteam.de; helo=mail.tuxteam.de 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, 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.29 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:279089 Archived-At: --Md/poaVZ8hnGTzuv Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Mon, Nov 08, 2021 at 06:32:41PM +0000, Drew Adams wrote: > Thanks for replying, Tomas. >=20 > > > I got no response to my question of how to tell > > > whether `mouse-1' is still pressed during a click. > >=20 > > [...] > >=20 > > I read twice through your text and I'm still trying > > to wrap my head around the gist of it. >=20 > Sorry for any confusion or difficulty. Come on. No need to apologise. > I can't tell if you mean that you had difficulty with > (1) the original post, asking how to tell when mouse-1 > is pressed (the text you quoted) or with (2) my last > message (with changed Subject), which is what you > replied to. Or perhaps you had difficulty with both? The direct ref would be (2), but my confusion is so diffuse that I'd take everything with its grain of salt :) > > My feeling (it mitght be totally wrong [...]) [...] > The problem I described is only with the implementation > of predicate `use-region-p'. Its (minor) failing is > only with a corner case: returning true between mouse-1 > down and up events during a click action (down & up at > the same place). Oh, I think I get it now. So I did the following experiment: (setq my-timer (run-with-timer 0 0.05 (lambda() (message "%s REG=3D%s" (current-time-string) (use-region-p))))) The antidote is: (cancel-timer my-timer) =2E..I keep it around in the same buffer. Now while the above is running, when I click with mouse-1, REG says "nil" /until/ I move the mouse far enough that the region is at least one char wide: then REG says t. If I go back to the starting point (while keeping mouse-1 down all the time), REG says nil again. I'm not a heavy mouse user (TBH, I'm a reluctant mouse user), but the above behaviour looks reasonable to me. > Event `down-mouse-1' (button-down) activates the region, [...] This doesn't happen for me. I've to drag the mouse a bit for the region to become active (a bit: one char width, as far as I can discern). FWIW, that's "my" Emacs: This is GNU Emacs, one component of the GNU/Linux operating system. GNU Emacs 28.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version 2.24.32, cairo version 1.16.0) of 2021-09-30 I haven't tried with -Q, but I would, if you think that might shed more light on the topic. > and event `mouse-1' (button-up) either (1) leaves it > activated, if the positions of down & up differ, or (2) > deactivates it, if those positions are the same. (See > function `mouse-drag-track' for details.) I think we're seeing different things, so there might still be a gap between what I think I've understood and what I've actually understood :) Cheers - t --Md/poaVZ8hnGTzuv Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.12 (GNU/Linux) iEYEARECAAYFAmGKW38ACgkQBcgs9XrR2kZgDACdEU/deR6dLm4IrR7U8Qgzaz7y gP4An0i7sTJnEFvrhd0TCsvd36JeOx0T =3E2B -----END PGP SIGNATURE----- --Md/poaVZ8hnGTzuv--