From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Mattias =?UTF-8?Q?Engdeg=C3=A5rd?= Newsgroups: gmane.emacs.bugs Subject: bug#38013: [PATCH] Rectangular region selection with mouse Date: Sat, 23 Nov 2019 13:46:08 +0100 Message-ID: <61064586-CCB1-4F40-9584-EA618FBB0D6B@acm.org> References: <83lft0m3ug.fsf@gnu.org> <3541E0E8-9E33-4FBD-B0D9-DFF77C241F6F@acm.org> <83y2wzlorw.fsf@gnu.org> <83v9s3lo5f.fsf@gnu.org> <75EC4FBC-F636-4D75-BAC4-982D85188794@acm.org> <9b9222ad-ead7-d0a0-0602-780d0680f070@gmx.at> <6bf229f4-c22f-c3c2-5158-5235f908de3c@gmx.at> <8ec84837-172c-1ce5-cab0-b4c96a86274e@gmx.at> <411EAB4E-B666-4263-8514-5F47391268B1@acm.org> <2df02c1f-fea4-f764-eba6-fd67de581755@gmx.at> <3b74a108-28e3-fd01-64a5-7c4302e3d979@gmx.at> <9A9D13F2-1F4F-4DD4-B92F-96FC4D91DFBD@acm.org> <83pni17x5b.fsf@gnu.org> <8B95D2D3-8E00-45BF-B57D-EFD49D79EB6A@acm.org> <83bltk95p7.fsf@gnu.org> <60DD9D65-C3F0-470E-8489-B333E1889D32@acm.org> <83ftio6lsy.fsf@gnu.org> <290E5E66-964B-4E29-B141-166447AD5556@acm.org> <175E5B2E-2256-4FCD-AA8E-9E5BC6DE7907@acm.org> <835zjavm8r.fsf@gnu.org> Mime-Version: 1.0 (Mac OS X Mail 12.4 \(3445.104.11\)) Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="232845"; mail-complaints-to="usenet@blaine.gmane.org" Cc: 38013@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sat Nov 23 13:48:20 2019 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1iYUpl-000yPc-Tn for geb-bug-gnu-emacs@m.gmane.org; Sat, 23 Nov 2019 13:48:18 +0100 Original-Received: from localhost ([::1]:58514 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iYUpk-00008p-Hc for geb-bug-gnu-emacs@m.gmane.org; Sat, 23 Nov 2019 07:48:16 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:36880) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iYUpb-00007H-I3 for bug-gnu-emacs@gnu.org; Sat, 23 Nov 2019 07:48:09 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iYUpZ-0006XY-LY for bug-gnu-emacs@gnu.org; Sat, 23 Nov 2019 07:48:07 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:47079) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iYUpW-0006Sy-Fn for bug-gnu-emacs@gnu.org; Sat, 23 Nov 2019 07:48:03 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1iYUpV-000656-JA for bug-gnu-emacs@gnu.org; Sat, 23 Nov 2019 07:48:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Mattias =?UTF-8?Q?Engdeg=C3=A5rd?= Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 23 Nov 2019 12:48:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 38013 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 38013-submit@debbugs.gnu.org id=B38013.157451323723305 (code B ref 38013); Sat, 23 Nov 2019 12:48:01 +0000 Original-Received: (at 38013) by debbugs.gnu.org; 23 Nov 2019 12:47:17 +0000 Original-Received: from localhost ([127.0.0.1]:55897 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iYUnz-00062e-RJ for submit@debbugs.gnu.org; Sat, 23 Nov 2019 07:46:29 -0500 Original-Received: from mail1442c50.megamailservers.eu ([91.136.14.42]:35562 helo=mail264c50.megamailservers.eu) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iYUnq-00062F-Pv for 38013@debbugs.gnu.org; Sat, 23 Nov 2019 07:46:21 -0500 X-Authenticated-User: mattiase@bredband.net DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=megamailservers.eu; s=maildub; t=1574513171; bh=BEcQxD6TweMrzYRigZlI8Vd7H/zsVTmLc75quua23uM=; h=Subject:From:In-Reply-To:Date:Cc:References:To:From; b=qdd+GAftBnDyZ/u16rxt+zLcHBEsRxycAknyGkWRIQ9HAPt8WZxfq1TU9CRL4KzDg HQbqTOA1ViudZA2v7PxqhCuMA9tsZiZeit37eO3399doL08B1FfE281IgOf4SCZIax HYvDTzugSSxvXBUHxZqgViycJM1+HA0mVEaS9Tmg= Feedback-ID: mattiase@acm.or Original-Received: from [192.168.0.4] (c188-150-171-71.bredband.comhem.se [188.150.171.71]) (authenticated bits=0) by mail264c50.megamailservers.eu (8.14.9/8.13.1) with ESMTP id xANCk9LX004576; Sat, 23 Nov 2019 12:46:10 +0000 In-Reply-To: <835zjavm8r.fsf@gnu.org> X-Mailer: Apple Mail (2.3445.104.11) X-CTCH-RefID: str=0001.0A0B0208.5DD92A13.002E, ss=1, re=0.000, recu=0.000, reip=0.000, cl=1, cld=1, fgs=0 X-CTCH-VOD: Unknown X-CTCH-Spam: Unknown X-CTCH-Score: 0.000 X-CTCH-Flags: 0 X-CTCH-ScoreCust: 0.000 X-CSC: 0 X-CHA: v=2.3 cv=ar3M9hRV c=1 sm=1 tr=0 a=SF+I6pRkHZhrawxbOkkvaA==:117 a=SF+I6pRkHZhrawxbOkkvaA==:17 a=jpOVt7BSZ2e4Z31A5e1TngXxSK0=:19 a=kj9zAlcOel0A:10 a=M51BFTxLslgA:10 a=mDV3o1hIAAAA:8 a=l-RGNXpYV7c3CnXFADoA:9 a=7Zwj6sZBwVKJAoWSPKxL6X1jA+E=:19 a=CjuIK1q_8ugA:10 a=_FVE-zBwftR9WsbkzFJk:22 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.51.188.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:172285 Archived-At: 23 nov. 2019 kl. 12.57 skrev Eli Zaretskii : >> +@defvar fine-grained-mouse-movement >=20 > I think this variable's name should start with "mouse-". Like > mouse-fine-grained-movement or something. True, but since the variable pertains to the 'mouse-movement' event in = particular and not to moving the mouse about in general, it is also = useful to have the name reflect that relation. 'mouse-movement-fine-grained' is possible but a bit awkward. What about = 'mouse-fine-grained-tracking'? >> + (setq fine-grained-mouse-movement t) >=20 > What happens if this function signals an error? won't > fine-grained-mouse-movement be left at its non-nil value? Good question. Ideally, the variable (and 'track-mouse') would be = dynamically bound during the drag. However, since the function, = mouse-drag-region-rectangle, returns as the drag commences, this is not = possible. The code follows the pattern of other functions in the same file in that = it trusts the exit function of the transient map to be executed = eventually, and the first thing done in that exit function is to reset = the variables. All these functions have a small hole between setting the variables and = the successful return of set-transient-map, during which an error will = not result in the variables being reset. We could wrap the = set-transient-map calls in condition-case everywhere, if we think that = this would increase robustness. Basically, (condition-case err (set-transient-map ...) (error (setq fine-grained-mouse-movement nil) (setq track-mouse nil) (signal (car err) (cdr err)))) An earlier version of the patch used the 'track-mouse' macro instead, = which does not have this problem, but I changed after complaints that it = does not permit independent use of the mouse click event. (For instance, = if the selection uses M-down-mouse-1 and M-drag-mouse-1, M-mouse-1 could = not be used for anything else.) However, I'm not convinced that this = would be much of a limitation. (Some code in mouse.el uses the track-mouse macro: = mouse-drag-and-drop-region and mouse-drag-secondary.)