From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Drew Adams Newsgroups: gmane.emacs.bugs Subject: bug#15960: 24.3.50; Provide a good way to tell when in `mouse-drag-track' (regression) Date: Sat, 23 Nov 2013 11:39:43 -0800 (PST) Message-ID: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1385235683 7075 80.91.229.3 (23 Nov 2013 19:41:23 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 23 Nov 2013 19:41:23 +0000 (UTC) To: 15960@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sat Nov 23 20:41:27 2013 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1VkJ55-0001z2-6t for geb-bug-gnu-emacs@m.gmane.org; Sat, 23 Nov 2013 20:41:27 +0100 Original-Received: from localhost ([::1]:44889 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VkJ54-0008Nh-T4 for geb-bug-gnu-emacs@m.gmane.org; Sat, 23 Nov 2013 14:41:26 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:35046) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VkJ4r-0008LJ-7p for bug-gnu-emacs@gnu.org; Sat, 23 Nov 2013 14:41:23 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VkJ4h-0002MX-3f for bug-gnu-emacs@gnu.org; Sat, 23 Nov 2013 14:41:13 -0500 Original-Received: from debbugs.gnu.org ([140.186.70.43]:54664) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VkJ4h-0002MT-0Q for bug-gnu-emacs@gnu.org; Sat, 23 Nov 2013 14:41:03 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1VkJ4g-0005Fu-As for bug-gnu-emacs@gnu.org; Sat, 23 Nov 2013 14:41:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Drew Adams Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 23 Nov 2013 19:41:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 15960 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.138523562820159 (code B ref -1); Sat, 23 Nov 2013 19:41:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 23 Nov 2013 19:40:28 +0000 Original-Received: from localhost ([127.0.0.1]:40448 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VkJ46-0005F4-UE for submit@debbugs.gnu.org; Sat, 23 Nov 2013 14:40:27 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:33078) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VkJ43-0005Eo-U9 for submit@debbugs.gnu.org; Sat, 23 Nov 2013 14:40:25 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VkJ3o-000287-Pt for submit@debbugs.gnu.org; Sat, 23 Nov 2013 14:40:18 -0500 Original-Received: from lists.gnu.org ([2001:4830:134:3::11]:35499) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VkJ3o-000282-NU for submit@debbugs.gnu.org; Sat, 23 Nov 2013 14:40:08 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:34625) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VkJ3g-000832-2R for bug-gnu-emacs@gnu.org; Sat, 23 Nov 2013 14:40:08 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VkJ3X-0001n2-Ev for bug-gnu-emacs@gnu.org; Sat, 23 Nov 2013 14:39:59 -0500 Original-Received: from userp1040.oracle.com ([156.151.31.81]:22657) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VkJ3X-0001me-7S for bug-gnu-emacs@gnu.org; Sat, 23 Nov 2013 14:39:51 -0500 Original-Received: from ucsinet21.oracle.com (ucsinet21.oracle.com [156.151.31.93]) by userp1040.oracle.com (Sentrion-MTA-4.3.1/Sentrion-MTA-4.3.1) with ESMTP id rANJdn3r004485 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Sat, 23 Nov 2013 19:39:49 GMT Original-Received: from userz7021.oracle.com (userz7021.oracle.com [156.151.31.85]) by ucsinet21.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id rANJdmAh020436 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Sat, 23 Nov 2013 19:39:49 GMT Original-Received: from abhmp0005.oracle.com (abhmp0005.oracle.com [141.146.116.11]) by userz7021.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id rANJdmf0020428 for ; Sat, 23 Nov 2013 19:39:48 GMT X-Priority: 3 X-Mailer: Oracle Beehive Extensions for Outlook 2.0.1.8 (707110) [OL 12.0.6680.5000 (x86)] X-Source-IP: ucsinet21.oracle.com [156.151.31.93] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4.x-2.6.x [generic] X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 140.186.70.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-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:80883 Archived-At: I have code (library modeline-posn.el) that lets users optionally show the active region size (highlighted) in the minibuffer, in place of the buffer size. My code did this, to test whether the region was active or the user wants to allow an empty region to be highlighted: (and transient-mark-mode mark-active (or modelinepos-empty-region-flag (/=3D (region-beginning) (region-end)))) With `modelinepos-empty-region-flag' non-nil, this made it easy for a user to see when the active region is empty. (The mode-line size indication is highlighted with face `region'.) Emacs 24 changed things, so that this mode-line highlighting now appeared immediately when you press `mouse-1', and did not wait until you actually drag the mouse or release `mouse-1'. This broke the user experience for this feature, because now each time s?he clicked `mouse-1', without any dragging, a zero-size-region indication showed in the mode line for as long as `mouse-1' was held down during the click. IOW, an annoying flash. Obviously that is no good, so I updated my code to try to test whether we are inside `mouse-drag-track'. I found no clean and sure way to do this, so I currently test `echo-keystrokes', which `mouse-drag-track' binds to 0. This seems to work fine, but it is obviously indirect and fragile. The bug report is to request some clearer, cleaner, and surer way to tell whether we are in `mouse-drag-track'. This is the code I use now for the test: (defun modelinepos-empty-region-p () "Return non-nil if region is active and empty. But do not return non-nil if this is true but you are selecting with the mouse. This is to prevent highlighting in the mode line whenever you press `mouse-1' without dragging at least one character." ;; Fragile hack: Starting with Emacs 24, the region is considered ;; empty as soon as you press `mouse-1' (`down-mouse-1'). That causes ;; modeline highlighting each time you just click `mouse-1', i.e., ;; without dragging it. ;; ;; The hack is to check whether `echo-keystrokes' is 0. ;; `mouse-drag-track' binds `echo-keystrokes' to 0, and that seems to ;; be the only way to tell whether we are in `mouse-drag-track'. ;; If the Emacs code for that changes then this might break. (and transient-mark-mode mark-active (or (if (> emacs-major-version 23) (and (not (eq 0 echo-keystrokes)) modelinepos-empty-region-flag) modelinepos-empty-region-flag) (/=3D (region-beginning) (region-end))))) In GNU Emacs 24.3.50.1 (i686-pc-mingw32) of 2013-11-12 on LEG570 Windowing system distributor `Microsoft Corp.', version 6.1.7601 Configured using: `configure --enable-checking 'CFLAGS=3D-O0 -g3' CPPFLAGS=3D-DGLYPH_DEBUG= =3D1'