GNU bug report logs - #13523
24.2.92; [regression] mark-active

Previous Next

Package: emacs;

Reported by: Leo Liu <sdl.web <at> gmail.com>

Date: Tue, 22 Jan 2013 08:21:02 UTC

Severity: important

Tags: confirmed, help

Found in versions 24.2, 24.1, 24.2.92

Done: Stefan Monnier <monnier <at> iro.umontreal.ca>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 13523 in the body.
You can then email your comments to 13523 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#13523; Package emacs. (Tue, 22 Jan 2013 08:21:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Leo Liu <sdl.web <at> gmail.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Tue, 22 Jan 2013 08:21:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Leo Liu <sdl.web <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: 24.2.92; [regression] mark-active
Date: Tue, 22 Jan 2013 16:03:53 +0800
I have just wasted a few hours wondering some odd behaviour in js2-mode
but to discover it is due to change between Emacs 23 and 24.

1. (global-set-key [mouse-1] (lambda (e) (interactive "e")))
2. Mouse-1 click on a buffer and check the value of mark-active

In emacs 23 it is nil; but in emacs 24.2/24.2.92, it is t.

With mark-active set to t, some commands following mouse-1 activate the
region unexpectedly and inconveniently, for example, in js2-mode, C-a
activate the region between the mouse and line beginning.

It seems 23 and 24 is consistent only if [mouse-1] is bound to
mouse-set-point.

As a result of this bug, most customised [mouse-1] commands fail to
handle mark-active i.e. it is subtle and hard to get the customised
mouse-1 command behave like mouse-set-point leaving users with creepy
behaviour like the one I am seeing in js2 mode.

Leo




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#13523; Package emacs. (Tue, 22 Jan 2013 08:30:02 GMT) Full text and rfc822 format available.

Message #8 received at 13523 <at> debbugs.gnu.org (full text, mbox):

From: Dmitry Gutov <dgutov <at> yandex.ru>
To: Leo Liu <sdl.web <at> gmail.com>
Cc: 13523 <at> debbugs.gnu.org
Subject: Re: bug#13523: 24.2.92; [regression] mark-active
Date: Tue, 22 Jan 2013 12:28:19 +0400
Leo Liu <sdl.web <at> gmail.com> writes:

> I have just wasted a few hours wondering some odd behaviour in js2-mode
> but to discover it is due to change between Emacs 23 and 24.
>
> 1. (global-set-key [mouse-1] (lambda (e) (interactive "e")))
> 2. Mouse-1 click on a buffer and check the value of mark-active
>
> In emacs 23 it is nil; but in emacs 24.2/24.2.92, it is t.
>
> With mark-active set to t, some commands following mouse-1 activate the
> region unexpectedly and inconveniently, for example, in js2-mode, C-a
> activate the region between the mouse and line beginning.
>
> It seems 23 and 24 is consistent only if [mouse-1] is bound to
> mouse-set-point.
>
> As a result of this bug, most customised [mouse-1] commands fail to
> handle mark-active i.e. it is subtle and hard to get the customised
> mouse-1 command behave like mouse-set-point leaving users with creepy
> behaviour like the one I am seeing in js2 mode.

As far as js2-mode goes, this is supposed to be fixed:
https://github.com/mooz/js2-mode/issues/77

Also see http://lists.gnu.org/archive/html/help-gnu-emacs/2012-12/msg00152.html




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#13523; Package emacs. (Tue, 22 Jan 2013 09:01:01 GMT) Full text and rfc822 format available.

Message #11 received at 13523 <at> debbugs.gnu.org (full text, mbox):

From: Leo Liu <sdl.web <at> gmail.com>
To: Dmitry Gutov <dgutov <at> yandex.ru>
Cc: 13523 <at> debbugs.gnu.org
Subject: Re: bug#13523: 24.2.92; [regression] mark-active
Date: Tue, 22 Jan 2013 16:59:38 +0800
On 2013-01-22 16:28 +0800, Dmitry Gutov wrote:
> As far as js2-mode goes, this is supposed to be fixed:
> https://github.com/mooz/js2-mode/issues/77

Thanks for the info. I am merely using js2 as an example; (my copy of
js2 is not even up-to-date).

> Also see
>http://lists.gnu.org/archive/html/help-gnu-emacs/2012-12/msg00152.html

I guess that thread didn't go anywhere.

But I can't believe such a design error has persisted for so long.
Hopefully someone get around to clean it up for the release.

Leo




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#13523; Package emacs. (Wed, 23 Jan 2013 08:08:01 GMT) Full text and rfc822 format available.

Message #14 received at 13523 <at> debbugs.gnu.org (full text, mbox):

From: Glenn Morris <rgm <at> gnu.org>
To: 13523 <at> debbugs.gnu.org
Cc: Chong Yidong <cyd <at> gnu.org>
Subject: Re: bug#13523: 24.2.92; [regression] mark-active
Date: Wed, 23 Jan 2013 03:06:10 -0500
So IIUC the issue can be summarized as:

down-mouse-1 runs mouse-drag-region
mouse-1 runs mouse-set-point

mouse-drag-region calls mouse-drag-track.
Since 2010-07-03 (I think), this unconditionally pushes mark.

It then uses track-mouse to watch for further mouse events.
If at the end, point has not moved and the last event was
mouse-set-point or mouse-set-region, it deactivates and pops the mark.

Otherwise it assumes it is handling a multi-click event (since
2010-07-05), and does not deactivate mark.

The result is that if you bind mouse-1 to something other than
mouse-set-point, and leave down-mouse-1 alone, then after a mouse-1 click
the mark stays active (unless you specifically deactivate it).

Examples can be seen with image-dired and rst-toc-mode, which both bind
mouse-1 but not down-mouse-1. In both cases, mouse-1 clicks leave the
mouse active. It doesn't seem to matter in either case, but probably is
not intended.

Is the intention that people bind down-mouse-1 as well/instead of
mouse-1, or that things bound to mouse-1 deactivate mark, or can the
multi-click detection be changed somehow to avoid this?




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#13523; Package emacs. (Wed, 23 Jan 2013 12:51:02 GMT) Full text and rfc822 format available.

Message #17 received at 13523 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> IRO.UMontreal.CA>
To: Glenn Morris <rgm <at> gnu.org>
Cc: 13523 <at> debbugs.gnu.org, Chong Yidong <cyd <at> gnu.org>
Subject: Re: bug#13523: 24.2.92; [regression] mark-active
Date: Wed, 23 Jan 2013 07:48:48 -0500
> It then uses track-mouse to watch for further mouse events.
> If at the end, point has not moved and the last event was
> mouse-set-point or mouse-set-region, it deactivates and pops the mark.

It should probably unconditionally deactivate the mark and let the
command of the up event run in the normal way.

> Is the intention that people bind down-mouse-1 as well/instead of
> mouse-1, or that things bound to mouse-1 deactivate mark, or can the
> multi-click detection be changed somehow to avoid this?

It can be changed, but IIRC this might be tricky.  Partly because the
current code is pretty tricky already.


        Stefan




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#13523; Package emacs. (Thu, 24 Jan 2013 01:23:02 GMT) Full text and rfc822 format available.

Message #20 received at 13523 <at> debbugs.gnu.org (full text, mbox):

From: Leo Liu <sdl.web <at> gmail.com>
To: Glenn Morris <rgm <at> gnu.org>
Cc: 13523 <at> debbugs.gnu.org, Chong Yidong <cyd <at> gnu.org>
Subject: Re: bug#13523: 24.2.92; [regression] mark-active
Date: Thu, 24 Jan 2013 09:20:27 +0800
On 2013-01-23 16:06 +0800, Glenn Morris wrote:
> In both cases, mouse-1 clicks leave the mouse active. It doesn't seem
> to matter in either case, but probably is not intended.

One example, C-s following mouse-1 click would unexpectedly activate
region.

Leo




bug Marked as found in versions 24.1. Request was from Glenn Morris <rgm <at> gnu.org> to control <at> debbugs.gnu.org. (Fri, 25 Jan 2013 02:45:01 GMT) Full text and rfc822 format available.

bug Marked as found in versions 24.2. Request was from Glenn Morris <rgm <at> gnu.org> to control <at> debbugs.gnu.org. (Fri, 25 Jan 2013 02:45:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#13523; Package emacs. (Sun, 27 Jan 2013 02:18:02 GMT) Full text and rfc822 format available.

Message #27 received at 13523 <at> debbugs.gnu.org (full text, mbox):

From: Glenn Morris <rgm <at> gnu.org>
To: Stefan Monnier <monnier <at> IRO.UMontreal.CA>
Cc: 13523 <at> debbugs.gnu.org, Chong Yidong <cyd <at> gnu.org>
Subject: Re: bug#13523: 24.2.92; [regression] mark-active
Date: Sat, 26 Jan 2013 21:16:47 -0500
Stefan Monnier wrote:

>> If at the end, point has not moved and the last event was
>> mouse-set-point or mouse-set-region, it deactivates and pops the mark.
>
> It should probably unconditionally deactivate the mark and let the
> command of the up event run in the normal way.

This seems like something that should be fixed for 24.3, but I don't see
how to do it.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#13523; Package emacs. (Mon, 28 Jan 2013 01:35:02 GMT) Full text and rfc822 format available.

Message #30 received at 13523 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Glenn Morris <rgm <at> gnu.org>
Cc: 13523 <at> debbugs.gnu.org, Chong Yidong <cyd <at> gnu.org>
Subject: Re: bug#13523: 24.2.92; [regression] mark-active
Date: Sun, 27 Jan 2013 20:33:46 -0500
>>> If at the end, point has not moved and the last event was
>>> mouse-set-point or mouse-set-region, it deactivates and pops the mark.
>> It should probably unconditionally deactivate the mark and let the
>> command of the up event run in the normal way.
> This seems like something that should be fixed for 24.3, but I don't see
> how to do it.

Fixing it right is clearly out of scope of 24.3, but I don't know either
how to patch it up for 24.3.


        Stefan




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#13523; Package emacs. (Wed, 30 Jan 2013 02:02:02 GMT) Full text and rfc822 format available.

Message #33 received at 13523 <at> debbugs.gnu.org (full text, mbox):

From: Glenn Morris <rgm <at> gnu.org>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: 13523 <at> debbugs.gnu.org, Chong Yidong <cyd <at> gnu.org>
Subject: Re: bug#13523: 24.2.92; [regression] mark-active
Date: Tue, 29 Jan 2013 21:00:42 -0500
Stefan Monnier wrote:

>>>> If at the end, point has not moved and the last event was
>>>> mouse-set-point or mouse-set-region, it deactivates and pops the mark.
[...]
> Fixing it right is clearly out of scope of 24.3, but I don't know either
> how to patch it up for 24.3.

Can we turn the test around, so that rather than saying "deactivate the
mark if the final event was mouse-set-point or mouse-set-region", we say
"deactivate the mark unless the final event was X or Y"?
(I don't know what X or Y are, something related to multi-clicks I guess.)




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#13523; Package emacs. (Thu, 31 Jan 2013 02:48:01 GMT) Full text and rfc822 format available.

Message #36 received at 13523 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Glenn Morris <rgm <at> gnu.org>
Cc: 13523 <at> debbugs.gnu.org, Chong Yidong <cyd <at> gnu.org>
Subject: Re: bug#13523: 24.2.92; [regression] mark-active
Date: Wed, 30 Jan 2013 21:47:11 -0500
> Can we turn the test around, so that rather than saying "deactivate the
> mark if the final event was mouse-set-point or mouse-set-region", we say
> "deactivate the mark unless the final event was X or Y"?
> (I don't know what X or Y are, something related to multi-clicks I guess.)

Can someone point out why the patch below wouldn't work?


        Stefan


=== modified file 'lisp/mouse.el'
--- lisp/mouse.el	2013-01-30 17:14:24 +0000
+++ lisp/mouse.el	2013-01-31 02:45:05 +0000
@@ -880,9 +880,9 @@
 		     (copy-region-as-kill (mark) (point)))))
 
 	  ;; Otherwise, run binding of terminating up-event.
+          (deactivate-mark)
 	  (if do-multi-click
 	      (goto-char start-point)
-	    (deactivate-mark)
 	    (unless moved-off-start
 	      (pop-mark)))
 





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#13523; Package emacs. (Thu, 31 Jan 2013 03:36:05 GMT) Full text and rfc822 format available.

Message #39 received at 13523 <at> debbugs.gnu.org (full text, mbox):

From: Glenn Morris <rgm <at> gnu.org>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: 13523 <at> debbugs.gnu.org, Chong Yidong <cyd <at> gnu.org>
Subject: Re: bug#13523: 24.2.92; [regression] mark-active
Date: Wed, 30 Jan 2013 22:34:36 -0500
Stefan Monnier wrote:

>> Can we turn the test around, so that rather than saying "deactivate the
>> mark if the final event was mouse-set-point or mouse-set-region", we say
>> "deactivate the mark unless the final event was X or Y"?
>> (I don't know what X or Y are, something related to multi-clicks I guess.)
>
> Can someone point out why the patch below wouldn't work?

Won't it break dragging to select a region and activate the mark?




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#13523; Package emacs. (Thu, 31 Jan 2013 07:23:01 GMT) Full text and rfc822 format available.

Message #42 received at 13523 <at> debbugs.gnu.org (full text, mbox):

From: Glenn Morris <rgm <at> gnu.org>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: 13523 <at> debbugs.gnu.org
Subject: Re: bug#13523: 24.2.92; [regression] mark-active
Date: Thu, 31 Jan 2013 02:21:48 -0500
Glenn Morris wrote:

>> Can someone point out why the patch below wouldn't work?
>
> Won't it break dragging to select a region and activate the mark?

Maybe not? I don't understand how any of this works...

Anyway, the conditional deactivation was introduced in r100728
  http://lists.gnu.org/archive/html/emacs-diffs/2010-07/msg00055.html
as something do with double and triple clicks.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#13523; Package emacs. (Thu, 31 Jan 2013 07:50:02 GMT) Full text and rfc822 format available.

Message #45 received at 13523 <at> debbugs.gnu.org (full text, mbox):

From: Glenn Morris <rgm <at> gnu.org>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: 13523 <at> debbugs.gnu.org
Subject: Re: bug#13523: 24.2.92; [regression] mark-active
Date: Thu, 31 Jan 2013 02:48:55 -0500
Glenn Morris wrote:

> I don't understand how any of this works...

Bearing that in mind, this seems odd:

  (> (event-click-count event) 0)

since surely event-click-count is always >= 1?
But this code predates 24.1.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#13523; Package emacs. (Thu, 31 Jan 2013 14:49:01 GMT) Full text and rfc822 format available.

Message #48 received at 13523 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> IRO.UMontreal.CA>
To: Glenn Morris <rgm <at> gnu.org>
Cc: 13523 <at> debbugs.gnu.org, Chong Yidong <cyd <at> gnu.org>
Subject: Re: bug#13523: 24.2.92; [regression] mark-active
Date: Thu, 31 Jan 2013 09:47:36 -0500
>>> Can we turn the test around, so that rather than saying "deactivate the
>>> mark if the final event was mouse-set-point or mouse-set-region", we say
>>> "deactivate the mark unless the final event was X or Y"?
>>> (I don't know what X or Y are, something related to multi-clicks I guess.)
>> Can someone point out why the patch below wouldn't work?
> Won't it break dragging to select a region and activate the mark?

I don't think so, because the next command (the one bound to the
up-event) should/will activate the mark (since the next event should be
a drag-mouse-1).

And in my tests, it seems to work just fine, indeed.

> Bearing that in mind, this seems odd:
>   (> (event-click-count event) 0)
> since surely event-click-count is always >= 1?

Indeed even (event-click-count ?a) returns 1, so the test seems broken.


        Stefan




Reply sent to Stefan Monnier <monnier <at> iro.umontreal.ca>:
You have taken responsibility. (Fri, 01 Feb 2013 23:43:01 GMT) Full text and rfc822 format available.

Notification sent to Leo Liu <sdl.web <at> gmail.com>:
bug acknowledged by developer. (Fri, 01 Feb 2013 23:43:01 GMT) Full text and rfc822 format available.

Message #53 received at 13523-done <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Glenn Morris <rgm <at> gnu.org>
Cc: Chong Yidong <cyd <at> gnu.org>, 13523-done <at> debbugs.gnu.org
Subject: Re: bug#13523: 24.2.92; [regression] mark-active
Date: Fri, 01 Feb 2013 18:41:52 -0500
> Can someone point out why the patch below wouldn't work?

I've installed the patch in emacs-24.


        Stefan




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Sat, 02 Mar 2013 12:24:03 GMT) Full text and rfc822 format available.

This bug report was last modified 12 years and 108 days ago.

Previous Next


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