GNU bug report logs - #18212
24.3.92; Left-click on a button is treated as mouse-2

Previous Next

Package: emacs;

Reported by: Matthew Woodcraft <matthew <at> woodcraft.me.uk>

Date: Wed, 6 Aug 2014 20:37:01 UTC

Severity: normal

Found in version 24.3.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 18212 in the body.
You can then email your comments to 18212 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#18212; Package emacs. (Wed, 06 Aug 2014 20:37:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Matthew Woodcraft <matthew <at> woodcraft.me.uk>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Wed, 06 Aug 2014 20:37:02 GMT) Full text and rfc822 format available.

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

From: Matthew Woodcraft <matthew <at> woodcraft.me.uk>
To: bug-gnu-emacs <at> gnu.org
Subject: 24.3.92; Left-click on a button is treated as mouse-2
Date: Wed, 06 Aug 2014 21:35:29 +0100
If click with my left mouse button (normally mouse-1) on "button" text,
Emacs appears to think I clicked mouse-2 (normally the middle button).


Recipe to reproduce:

emacs -Q --exec "(global-set-key (kbd \"<down-mouse-2>\") 'clipboard-yank)" --exec "(info)"

Left-click on one of the hyperlinks.

Emacs says
  Buffer is read-only: #<buffer *info*>
rather than following the hyperlink.


Using describe-key with a left click suggests that Emacs thinks that,
when over a 'button', the left click is mouse-2:
«
<down-mouse-2> at that spot runs the command clipboard-yank, which is
an interactive compiled Lisp function in `menu-bar.el'.
»
If I click somewhere that isn't a 'button', Emacs thinks it's mouse-1.


The problem didn't happen with the released Emacs 24.3.

This Emacs was built from the emacs-24 branch as of 2014-08-03.

In GNU Emacs 24.3.92.1 (i486-pc-linux-gnu, GTK+ Version 3.4.2)
 of 2014-08-03 on golux, modified by Debian
 (emacs-snapshot package, version 2:20140803-mjw1)
Windowing system distributor `The X.Org Foundation', version 11.0.11204000
System Description:	Debian GNU/Linux 7.6 (wheezy)

Configured using:
 `configure --build i486-linux-gnu --host i486-linux-gnu --prefix=/usr
 --sharedstatedir=/var/lib --libexecdir=/usr/lib --localstatedir=/var
 --infodir=/usr/share/info/emacs-snapshot --mandir=/usr/share/man
 --with-pop=yes
 --enable-locallisppath=/etc/emacs-snapshot:/etc/emacs:/usr/local/share/emacs/24.3.92/site-lisp:/usr/local/share/emacs/site-lisp:/usr/share/emacs/24.3.92/site-lisp:/usr/share/emacs/site-lisp
 --enable-silent-rules --enable-link-time-optimization
 --with-crt-dir=/usr/lib/i386-linux-gnu/ --with-x=yes
 --with-x-toolkit=gtk3 --with-toolkit-scroll-bars --with-imagemagick=yes
 'CFLAGS=-g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat
 -Werror=format-security' CPPFLAGS=-D_FORTIFY_SOURCE=2
 LDFLAGS=-Wl,-z,relro'

Important settings:
  value of $LC_CTYPE: en_GB.UTF-8
  locale-coding-system: utf-8-unix





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#18212; Package emacs. (Thu, 07 Aug 2014 00:00:03 GMT) Full text and rfc822 format available.

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

From: Glenn Morris <rgm <at> gnu.org>
To: Matthew Woodcraft <matthew <at> woodcraft.me.uk>
Cc: 18212 <at> debbugs.gnu.org
Subject: Re: bug#18212: 24.3.92; Left-click on a button is treated as mouse-2
Date: Wed, 06 Aug 2014 19:59:02 -0400
Matthew Woodcraft wrote:

> If click with my left mouse button (normally mouse-1) on "button" text,
> Emacs appears to think I clicked mouse-2 (normally the middle button).

I think you are just describing mouse-1-click-follows-link?




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#18212; Package emacs. (Thu, 07 Aug 2014 13:09:02 GMT) Full text and rfc822 format available.

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

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Matthew Woodcraft <matthew <at> woodcraft.me.uk>
Cc: 18212 <at> debbugs.gnu.org
Subject: Re: bug#18212: 24.3.92; Left-click on a button is treated as mouse-2
Date: Thu, 07 Aug 2014 09:08:21 -0400
> If click with my left mouse button (normally mouse-1) on "button" text,
> Emacs appears to think I clicked mouse-2 (normally the middle button).

This is normal: it's because of mouse-1-click-follows-link and because
the button has the `follow-link' property.

> Recipe to reproduce:

> emacs -Q --exec "(global-set-key (kbd \"<down-mouse-2>\") 'clipboard-yank)" --exec "(info)"

> Left-click on one of the hyperlinks.

> Emacs says
>   Buffer is read-only: #<buffer *info*>
> rather than following the hyperlink.

But that is indeed a bug.  I guess the button should locally bind
`down-mouse-2' to override the global binding.

But, in any case I recommend you bind clipboard-yank to `mouse-2' rather
than to `down-mouse-2' since you otherwise get a "double yank" behavior
(a mouse-2 click will first run clipboard-yank because of the
down-mouse-2 binding and then will run mouse-yank-primary because it's
bound to mouse-2).


        Stefan




Reply sent to Stefan Monnier <monnier <at> iro.umontreal.ca>:
You have taken responsibility. (Thu, 07 Aug 2014 18:37:02 GMT) Full text and rfc822 format available.

Notification sent to Matthew Woodcraft <matthew <at> woodcraft.me.uk>:
bug acknowledged by developer. (Thu, 07 Aug 2014 18:37:03 GMT) Full text and rfc822 format available.

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

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Matthew Woodcraft <matthew <at> woodcraft.me.uk>
Cc: 18212-done <at> debbugs.gnu.org
Subject: Re: bug#18212: 24.3.92; Left-click on a button is treated as mouse-2
Date: Thu, 07 Aug 2014 14:36:42 -0400
> emacs -Q --exec "(global-set-key (kbd \"<down-mouse-2>\") 'clipboard-yank)" --exec "(info)"
> Left-click on one of the hyperlinks.
> Emacs says
>   Buffer is read-only: #<buffer *info*>
> rather than following the hyperlink.

BTW, if you middle-click instead of left-click, you also get this error,
but you still follow the hyperlink (so you usually only see the error
if you go look for it in *Messages*).

The fundamental reason for the difference is that
mouse-1-click-follows-link defaults to 450, which means that we can't
decide whether the down-mouse-1 should be turned into a down-mouse-2 or
not until either we see the subsequent mouse-1 or 450ms have passed.
In this case, the 450ms typically don't pass, but we had to wait for the
mouse-1 to arrive.  At that point we turn those two events into
down-mouse-2 and mouse-2.  So it looks just the same as what happens for
a middle-click.  The crucial difference is that when the command bound
to down-mouse-2 is run, we have already received the mouse-1 (aka
mouse-2), and since errors have the side effect of emptying the "not yet
processed input", the error on down-mouse-2 ends up canceling the
subsequent mouse-1/2.

I installed the workaround below,


        Stefan


--- lisp/info.el	2014-03-14 20:51:22 +0000
+++ lisp/info.el	2014-08-07 18:28:18 +0000
@@ -3994,6 +3994,7 @@
     (define-key map "," 'Info-index-next)
     (define-key map "\177" 'Info-scroll-down)
     (define-key map [mouse-2] 'Info-mouse-follow-nearest-node)
+    (define-key map [down-mouse-2] 'ignore) ;Override potential global binding.
     (define-key map [follow-link] 'mouse-face)
     (define-key map [XF86Back] 'Info-history-back)
     (define-key map [XF86Forward] 'Info-history-forward)





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#18212; Package emacs. (Thu, 07 Aug 2014 21:03:02 GMT) Full text and rfc822 format available.

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

From: Matthew Woodcraft <matthew <at> woodcraft.me.uk>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: 18212 <at> debbugs.gnu.org
Subject: Re: bug#18212: 24.3.92; Left-click on a button is treated as mouse-2
Date: Thu, 7 Aug 2014 22:02:28 +0100
Stefan Monnier wrote:
> The fundamental reason for the difference is that
> mouse-1-click-follows-link defaults to 450, which means that we can't
> decide whether the down-mouse-1 should be turned into a down-mouse-2 or
> not until either we see the subsequent mouse-1 or 450ms have passed.
> In this case, the 450ms typically don't pass, but we had to wait for the
> mouse-1 to arrive.  At that point we turn those two events into
> down-mouse-2 and mouse-2.  So it looks just the same as what happens for
> a middle-click.  The crucial difference is that when the command bound
> to down-mouse-2 is run, we have already received the mouse-1 (aka
> mouse-2), and since errors have the side effect of emptying the "not yet
> processed input", the error on down-mouse-2 ends up canceling the
> subsequent mouse-1/2.

I see.


> I installed the workaround below,

> --- lisp/info.el	2014-03-14 20:51:22 +0000
> +++ lisp/info.el	2014-08-07 18:28:18 +0000
> @@ -3994,6 +3994,7 @@
>      (define-key map "," 'Info-index-next)
>      (define-key map "\177" 'Info-scroll-down)
>      (define-key map [mouse-2] 'Info-mouse-follow-nearest-node)
> +    (define-key map [down-mouse-2] 'ignore) ;Override potential global binding.
>      (define-key map [follow-link] 'mouse-face)
>      (define-key map [XF86Back] 'Info-history-back)
>      (define-key map [XF86Forward] 'Info-history-forward)

Is that the right place for the workaround? The problem happens for any
link, not just those in info mode.

Maybe there's some way to behave more like 24.3, where (as far as I can
make out from describe-key output) left-click on a link gives
down-mouse-1 followed by mouse-2?


(This issue isn't causing me any problems; I'm just testing the pretest.
I had imenu bound to down-mouse-2 because it's slightly more responsive
than mouse-2, and left-clicking to follow links stopped working
altogether until I found out what was responsible. So I suppose it might
cause trouble for other people when they upgrade.)

-M-




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#18212; Package emacs. (Fri, 08 Aug 2014 02:29:02 GMT) Full text and rfc822 format available.

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

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Matthew Woodcraft <matthew <at> woodcraft.me.uk>
Cc: 18212 <at> debbugs.gnu.org
Subject: Re: bug#18212: 24.3.92; Left-click on a button is treated as mouse-2
Date: Thu, 07 Aug 2014 22:28:38 -0400
> Is that the right place for the workaround? The problem happens for any
> link, not just those in info mode.

Good question.

> Maybe there's some way to behave more like 24.3, where (as far as I can
> make out from describe-key output) left-click on a link gives
> down-mouse-1 followed by mouse-2?

24.3 indeed does not go through down-mouse-2 (because the implementation is
based on a "normal" binding of down-mouse-1 rather than a key-remapping
of down-mouse-1).
So maybe you're right here.  Hmm...

> (This issue isn't causing me any problems; I'm just testing the pretest.
> I had imenu bound to down-mouse-2 because it's slightly more responsive
> than mouse-2, and left-clicking to follow links stopped working
> altogether until I found out what was responsible. So I suppose it might
> cause trouble for other people when they upgrade.)

Indeed things like imenu are better bound to down-mouse-2 than to mouse-2.

I'll sleep on it and try to remember to come back to it tomorrow,


        Stefan




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#18212; Package emacs. (Fri, 08 Aug 2014 18:39:02 GMT) Full text and rfc822 format available.

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

From: Stefan Monnier <monnier <at> IRO.UMontreal.CA>
To: Matthew Woodcraft <matthew <at> woodcraft.me.uk>
Cc: 18212-done <at> debbugs.gnu.org
Subject: Re: bug#18212: 24.3.92; Left-click on a button is treated as mouse-2
Date: Fri, 08 Aug 2014 14:38:29 -0400
> 24.3 indeed does not go through down-mouse-2 (because the implementation is
> based on a "normal" binding of down-mouse-1 rather than a key-remapping
> of down-mouse-1).
> So maybe you're right here.  Hmm...
[...]
> I'll sleep on it and try to remember to come back to it tomorrow,

I installed that change 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, 06 Sep 2014 11:24:03 GMT) Full text and rfc822 format available.

This bug report was last modified 9 years and 235 days ago.

Previous Next


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