Subject: bug#24755: closed (Re: bug#24755: 25.1; Selection continues with no mouse button pressed)

From: [email-masked] (GNU bug Tracking System)
Date: Wed, 26 Oct 2016 19:31:02 +0000

Your bug report

#24755: 25.1; Selection continues with no mouse button pressed

which was filed against the emacs package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to [email-masked].

-- 
24755: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=24755
GNU Bug Tracking System
Contact [email-masked] with problems

Subject: Re: bug#24755: 25.1; Selection continues with no mouse button pressed
From: Stefan Monnier <[email-masked]>
To: Eli Zaretskii <[email-masked]>
Cc: [email-masked], Mats Palmgren <[email-masked]>
Date: Wed, 26 Oct 2016 15:29:55 -0400
List-Id: <debbugs-submit.debbugs.gnu.org>

> Stefan, could you please fix this?  It seems to be due to changes in
> how mouse-drag-track handles mouse events: in Emacs 24.5, the code
> handled mouse clicks as well, whereas now it doesn't seem to.  So
> releasing the mouse button while Ctrl or Shift is pressed signals an
> error now, instead of finishing the drag event.

> The fix should go to the emacs-25 branch.

I pushed the patch below to emacs-25, which should fix it.

        Stefan

diff --git a/lisp/subr.el b/lisp/subr.el
index 573f238..07909b8 100644
--- a/lisp/subr.el
+++ b/lisp/subr.el
@@ -4507,8 +4507,10 @@ set-transient-map
                         ;; exit C-u.
                         t)
                        ((eq t keep-pred)
-                        (eq this-command
-                            (lookup-key map (this-command-keys-vector))))
+                        (let ((mc (lookup-key map (this-command-keys-vector))))
+                          ;; If the key is unbound `this-command` is
+                          ;; nil and so is `mc`.
+                          (and mc (eq this-command mc))))
                        (t (funcall keep-pred)))
                 (funcall exitfun)))))
     (add-hook 'pre-command-hook clearfun)

Subject: 25.1; Selection continues with no mouse button pressed
From: Mats Palmgren <[email-masked]>
To: [email-masked]
Date: Fri, 21 Oct 2016 16:56:00 +0200
List-Id: <debbugs-submit.debbugs.gnu.org>

1. Visit a buffer with some text
2. Press the left mouse button
3. Drag the mouse to select some text
4. Press the Control key
5. Release the mouse button
6. Continue to move the mouse

Actual Result:
Moving the mouse continues to select text, even though no mouse button
or keys are pressed.

Expected Result:
Selection should stop at 5.

Unfortunately, it's fairly common for me to do 4 before 5 (in
preparation for deleting the selection with C-w for example) so
version 25 is unusable for me with this bug.  This is a new
behavior in v25, it's not present in v23 or earlier versions
that I've used.

In GNU Emacs 25.1.1 (x86_64-unknown-linux-gnu, GTK+ Version 3.18.9)
Windowing system distributor 'The X.Org Foundation', version 11.0.11804000
System Description:	Ubuntu 16.04.1 LTS

Thanks,
Mats