--- Begin Message ---
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
--- End Message ---
--- Begin Message ---
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 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.4.50 (gnu/linux) |
> 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)
--- End Message ---