GNU bug report logs - #15960
24.3.50; Provide a good way to tell when in `mouse-drag-track' (regression)

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: emacs; Severity: minor; Reported by: Drew Adams <drew.adams@HIDDEN>; dated Sat, 23 Nov 2013 19:41:02 UTC; Maintainer for emacs is bug-gnu-emacs@HIDDEN.

Message received at 15960 <at> debbugs.gnu.org:


Received: (at 15960) by debbugs.gnu.org; 24 Nov 2013 00:43:00 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Nov 23 19:43:00 2013
Received: from localhost ([127.0.0.1]:40848 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.80)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1VkNmu-0004DU-GS
	for submit <at> debbugs.gnu.org; Sat, 23 Nov 2013 19:43:00 -0500
Received: from ironport2-out.teksavvy.com ([206.248.154.181]:50878)
 by debbugs.gnu.org with esmtp (Exim 4.80)
 (envelope-from <monnier@HIDDEN>) id 1VkNms-0004DH-1h
 for 15960 <at> debbugs.gnu.org; Sat, 23 Nov 2013 19:42:58 -0500
X-IronPort-Anti-Spam-Filtered: true
X-IronPort-Anti-Spam-Result: Av8EABK/CFHO+K4R/2dsb2JhbABEuzWDWRdzgh4BAQQBViMFCws0EhQYDSSIHgbBLZEKA4hhnBmBXoMV
X-IPAS-Result: Av8EABK/CFHO+K4R/2dsb2JhbABEuzWDWRdzgh4BAQQBViMFCws0EhQYDSSIHgbBLZEKA4hhnBmBXoMV
X-IronPort-AV: E=Sophos;i="4.84,565,1355115600"; d="scan'208";a="40253587"
Received: from 206-248-174-17.dsl.teksavvy.com (HELO fmsmemgm.homelinux.net)
 ([206.248.174.17])
 by ironport2-out.teksavvy.com with ESMTP/TLS/ADH-AES256-SHA;
 23 Nov 2013 19:42:51 -0500
Received: by fmsmemgm.homelinux.net (Postfix, from userid 20848)
 id B8312AE129; Sat, 23 Nov 2013 19:42:50 -0500 (EST)
From: Stefan Monnier <monnier@HIDDEN>
To: Drew Adams <drew.adams@HIDDEN>
Subject: Re: bug#15960: 24.3.50;
 Provide a good way to tell when in `mouse-drag-track' (regression)
Message-ID: <jwv4n72d41w.fsf-monnier+emacsbugs@HIDDEN>
References: <ed8eb56a-e02f-435b-9679-82c3853e0fd4@default>
 <jwva9gudbcn.fsf-monnier+emacsbugs@HIDDEN>
 <25e6e155-4da6-4d8c-bf2a-12f7e7f80c4c@default>
Date: Sat, 23 Nov 2013 19:42:50 -0500
In-Reply-To: <25e6e155-4da6-4d8c-bf2a-12f7e7f80c4c@default> (Drew Adams's
 message of "Sat, 23 Nov 2013 15:21:35 -0800 (PST)")
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: 0.3 (/)
X-Debbugs-Envelope-To: 15960
Cc: 15960 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: 0.3 (/)

> But the behavior of the highlighting appearing now before you release
> mouse-1 is a definite improvement.  I would not wish to see that lost
> because of the "fix".  This just should not happen unless at least one
> char is selected.

Sounds right.  That's why I think it's just a bug/misfeature.

> Providing a good, clean way to tell whether `mouse-drag-track' is in
> progress (e.g. `mouse-tracking-p') would solve the problem I am
> reporting.

It would just give you a way to work around the problem.  I'd much
rather fix it instead.


        Stefan




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#15960; Package emacs. Full text available.

Message received at 15960 <at> debbugs.gnu.org:


Received: (at 15960) by debbugs.gnu.org; 23 Nov 2013 23:21:51 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Nov 23 18:21:50 2013
Received: from localhost ([127.0.0.1]:40730 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.80)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1VkMWM-0002DJ-K3
	for submit <at> debbugs.gnu.org; Sat, 23 Nov 2013 18:21:50 -0500
Received: from aserp1040.oracle.com ([141.146.126.69]:49233)
 by debbugs.gnu.org with esmtp (Exim 4.80)
 (envelope-from <drew.adams@HIDDEN>) id 1VkMWL-0002D6-7n
 for 15960 <at> debbugs.gnu.org; Sat, 23 Nov 2013 18:21:49 -0500
Received: from ucsinet21.oracle.com (ucsinet21.oracle.com [156.151.31.93])
 by aserp1040.oracle.com (Sentrion-MTA-4.3.1/Sentrion-MTA-4.3.1) with ESMTP id
 rANNLgca026207
 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK);
 Sat, 23 Nov 2013 23:21:43 GMT
Received: from aserz7021.oracle.com (aserz7021.oracle.com [141.146.126.230])
 by ucsinet21.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id rANNLeSF028836
 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO);
 Sat, 23 Nov 2013 23:21:42 GMT
Received: from abhmp0005.oracle.com (abhmp0005.oracle.com [141.146.116.11])
 by aserz7021.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id rANNLetZ016658;
 Sat, 23 Nov 2013 23:21:40 GMT
MIME-Version: 1.0
Message-ID: <25e6e155-4da6-4d8c-bf2a-12f7e7f80c4c@default>
Date: Sat, 23 Nov 2013 15:21:35 -0800 (PST)
From: Drew Adams <drew.adams@HIDDEN>
To: Stefan Monnier <monnier@HIDDEN>
Subject: RE: bug#15960: 24.3.50; Provide a good way to tell when in
 `mouse-drag-track' (regression)
References: <ed8eb56a-e02f-435b-9679-82c3853e0fd4@default>
 <jwva9gudbcn.fsf-monnier+emacsbugs@HIDDEN>
In-Reply-To: <jwva9gudbcn.fsf-monnier+emacsbugs@HIDDEN>
X-Priority: 3
X-Mailer: Oracle Beehive Extensions for Outlook 2.0.1.8  (707110) [OL
 12.0.6680.5000 (x86)]
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: quoted-printable
X-Source-IP: ucsinet21.oracle.com [156.151.31.93]
X-Spam-Score: -2.8 (--)
X-Debbugs-Envelope-To: 15960
Cc: 15960 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -2.8 (--)

> > 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'.
>=20
> Might simply be a bug.  I suggest you focus on tracking why this is.

It might.  I have no objection to it being seen as a bug, and fixed.

But the behavior of the highlighting appearing now before you release
mouse-1 is a definite improvement.  I would not wish to see that lost
because of the "fix".  This just should not happen unless at least one
char is selected.

In any case, Chong Yidong (I think) changed the code considerably for
Emacs 24.  It will take someone more knowledgable than I to figure it
out, let alone figure out just what was intended vs what might have
been accidental.

Providing a good, clean way to tell whether `mouse-drag-track' is in
progress (e.g. `mouse-tracking-p') would solve the problem I am
reporting.  I would guess that it might also be useful more generally.

But if you don't see it that way and don't want to fix this, I'll
continue to rely on (eq 0 echo-keystrokes) as the test for this.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#15960; Package emacs. Full text available.

Message received at 15960 <at> debbugs.gnu.org:


Received: (at 15960) by debbugs.gnu.org; 23 Nov 2013 22:04:38 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Nov 23 17:04:38 2013
Received: from localhost ([127.0.0.1]:40615 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.80)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1VkLJd-0000Kd-PI
	for submit <at> debbugs.gnu.org; Sat, 23 Nov 2013 17:04:38 -0500
Received: from ironport2-out.teksavvy.com ([206.248.154.181]:52000)
 by debbugs.gnu.org with esmtp (Exim 4.80)
 (envelope-from <monnier@HIDDEN>) id 1VkLJc-0000KQ-2y
 for 15960 <at> debbugs.gnu.org; Sat, 23 Nov 2013 17:04:36 -0500
X-IronPort-Anti-Spam-Filtered: true
X-IronPort-Anti-Spam-Result: Av8EABK/CFHO+K4R/2dsb2JhbABEuzWDWRdzgh4BAQQBViMFCws0EhQYDSSIHgbBLZEKA4hhnBmBXoMV
X-IPAS-Result: Av8EABK/CFHO+K4R/2dsb2JhbABEuzWDWRdzgh4BAQQBViMFCws0EhQYDSSIHgbBLZEKA4hhnBmBXoMV
X-IronPort-AV: E=Sophos;i="4.84,565,1355115600"; d="scan'208";a="40247674"
Received: from 206-248-174-17.dsl.teksavvy.com (HELO fmsmemgm.homelinux.net)
 ([206.248.174.17])
 by ironport2-out.teksavvy.com with ESMTP/TLS/ADH-AES256-SHA;
 23 Nov 2013 17:04:30 -0500
Received: by fmsmemgm.homelinux.net (Postfix, from userid 20848)
 id D35B6AE16D; Sat, 23 Nov 2013 17:04:29 -0500 (EST)
From: Stefan Monnier <monnier@HIDDEN>
To: Drew Adams <drew.adams@HIDDEN>
Subject: Re: bug#15960: 24.3.50;
 Provide a good way to tell when in `mouse-drag-track' (regression)
Message-ID: <jwva9gudbcn.fsf-monnier+emacsbugs@HIDDEN>
References: <ed8eb56a-e02f-435b-9679-82c3853e0fd4@default>
Date: Sat, 23 Nov 2013 17:04:29 -0500
In-Reply-To: <ed8eb56a-e02f-435b-9679-82c3853e0fd4@default> (Drew Adams's
 message of "Sat, 23 Nov 2013 11:39:43 -0800 (PST)")
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: 0.3 (/)
X-Debbugs-Envelope-To: 15960
Cc: 15960 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: 0.3 (/)

> 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'.

Might simply be a bug.  I suggest you focus on tracking why this is.


        Stefan




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#15960; Package emacs. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 23 Nov 2013 19:40:28 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Nov 23 14:40:28 2013
Received: from localhost ([127.0.0.1]:40448 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.80)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1VkJ46-0005F4-UE
	for submit <at> debbugs.gnu.org; Sat, 23 Nov 2013 14:40:27 -0500
Received: from eggs.gnu.org ([208.118.235.92]:33078)
 by debbugs.gnu.org with esmtp (Exim 4.80)
 (envelope-from <drew.adams@HIDDEN>) id 1VkJ43-0005Eo-U9
 for submit <at> debbugs.gnu.org; Sat, 23 Nov 2013 14:40:25 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <drew.adams@HIDDEN>) id 1VkJ3o-000287-Pt
 for submit <at> debbugs.gnu.org; Sat, 23 Nov 2013 14:40:18 -0500
X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org
X-Spam-Level: 
X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50 autolearn=disabled
 version=3.3.2
Received: from lists.gnu.org ([2001:4830:134:3::11]:35499)
 by eggs.gnu.org with esmtp (Exim 4.71)
 (envelope-from <drew.adams@HIDDEN>) id 1VkJ3o-000282-NU
 for submit <at> debbugs.gnu.org; Sat, 23 Nov 2013 14:40:08 -0500
Received: from eggs.gnu.org ([2001:4830:134:3::10]:34625)
 by lists.gnu.org with esmtp (Exim 4.71)
 (envelope-from <drew.adams@HIDDEN>) id 1VkJ3g-000832-2R
 for bug-gnu-emacs@HIDDEN; Sat, 23 Nov 2013 14:40:08 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <drew.adams@HIDDEN>) id 1VkJ3X-0001n2-Ev
 for bug-gnu-emacs@HIDDEN; Sat, 23 Nov 2013 14:39:59 -0500
Received: from userp1040.oracle.com ([156.151.31.81]:22657)
 by eggs.gnu.org with esmtp (Exim 4.71)
 (envelope-from <drew.adams@HIDDEN>) id 1VkJ3X-0001me-7S
 for bug-gnu-emacs@HIDDEN; Sat, 23 Nov 2013 14:39:51 -0500
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 <bug-gnu-emacs@HIDDEN>; Sat, 23 Nov 2013 19:39:49 GMT
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 <bug-gnu-emacs@HIDDEN>; Sat, 23 Nov 2013 19:39:49 GMT
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 <bug-gnu-emacs@HIDDEN>; Sat, 23 Nov 2013 19:39:48 GMT
MIME-Version: 1.0
Message-ID: <ed8eb56a-e02f-435b-9679-82c3853e0fd4@default>
Date: Sat, 23 Nov 2013 11:39:43 -0800 (PST)
From: Drew Adams <drew.adams@HIDDEN>
To: bug-gnu-emacs@HIDDEN
Subject: 24.3.50; Provide a good way to tell when in `mouse-drag-track'
 (regression)
X-Priority: 3
X-Mailer: Oracle Beehive Extensions for Outlook 2.0.1.8  (707110) [OL
 12.0.6680.5000 (x86)]
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: quoted-printable
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-Received-From: 2001:4830:134:3::11
X-Spam-Score: -4.0 (----)
X-Debbugs-Envelope-To: submit
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -4.0 (----)

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'




Acknowledgement sent to Drew Adams <drew.adams@HIDDEN>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs@HIDDEN. Full text available.
Report forwarded to bug-gnu-emacs@HIDDEN:
bug#15960; Package emacs. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Fri, 31 Oct 2014 17:00:04 UTC

GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997 nCipher Corporation Ltd, 1994-97 Ian Jackson.