From unknown Fri Aug 15 19:30:03 2025 X-Loop: help-debbugs@gnu.org Subject: bug#23288: 25.0.92; Clicking on links inserts primary X selection Resent-From: Philipp Stephani
I've tracked down the bug to mouse--down-1-may= be-follows-link too, but don't think read-event is the culprit here. Rather, mouse--down-1-maybe-follows-link discards the resu= lt of mouse-on-link-p, which contains the event a click is supposed to be t= ranslated into. Instead, it just replaces the mouse event with mouse-2 if m= ouse-on-link-p returns non-nil.
I've tracked down the bug to mouse--down-1-maybe-follows-link too= , but don't think read-event is the culprit here.Ra= ther, mouse--down-1-maybe-follows-link discards the result of mouse-on-link= -p, which contains the event a click is supposed to be translated into. Ins= tead, it just replaces the mouse event with mouse-2 if mouse-on-link-p retu= rns non-nil.
I applied the patch, and the paste-on-click behavi= or is gone.However, if you try your original example ag= ain, you'll find that nothing happens at all, when we're expecting = an "a" to be inserted.As the documentation of mouse-on= -link-p says, a string or vector return value indicates the event to transl= ate the original mouse-1 click into. In emacs24, that translation was done = in mouse-drag-track:=(let (on-link (and mouse-1-click-follow= s-link=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0;; Use start-point before the intangibility=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0 =C2=A0;; treatment, in case we click on a link inside=C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0;; intangible text.= =C2=A0 (mouse-on-link-p start-posn)))=C2=A0 (if (or (vec= torp on-link) (stringp on-link))=C2=A0(setq event (aref on-link 0))(select-window original-window)<= span style=3D"white-space:pre-wrap"> (setcar event 'mouse-2);; If this mouse clic= k has never been done by the;; user, it doesn't have the necessary property to be;; interpreted correctly.<= /div> (put 'mouse-2 &= #39;event-kind 'mouse-click)))(abridged= from mouse.el:791/901 in Emacs 24.3.1)I think mo= use--down-1-maybe-follows-link should do something similar.Agreed.=C2=A0https://debbugs.gnu.org/cgi/bugreport.= cgi?bug=3D17887=C2=A0might also be related.
I applied the p= atch, and the paste-on-click behavior is gone.However, = if you try your original example again, you'll find that nothing happen= s at all, when we're expecting an "a" to be inserted.As the documentation of mouse-on-link-p says, a string or vector return = value indicates the event to translate the original mouse-1 click into. In = emacs24, that translation was done in mouse-drag-track: (let= (on-link (and mouse-1-click-follows-link=C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0;; Use start-= point before the intangibility=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0;; treatment, in case we c= lick on a link inside=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0;; intangible text.=C2=A0 (mouse-on-link-p start-po= sn))) =C2=A0 (if (or (vectorp on-link) (stringp on-link))=C2=A0(setq event (aref o= n-link 0)) (select-= window original-window)= span>(setcar event 'mouse-2);; If this mouse click has never been done by the<= span style=3D"white-space:pre-wrap"> ;; user, it doesn't have t= he necessary property to be= ;; interpreted correctly.(put 'mouse-2 'event-kind 'mouse-click)))=
> From: Philipp Stephani <p.stephani2@gmail.com>
> Date: Tue, 10 May 2016 21:25:47 +0000
> Cc: 23288@debbugs.gnu.org=
>
>=C2=A0 Agreed. https://debbugs.gnu.org/cgi/= bugreport.cgi?bug=3D17887 might also be related.
>
> I've attached a new patch that should hopefully correct the behavi= or.
Thanks.=C2=A0 If no one objects in a week, please push to the master=
branch.
There was a small bu= g in the patch. I've attached a new version that hopefully fixes that.<= div>N= ils Berg <nilsb@go= ogle.com> schrieb am Mi., 11. Mai 2016 um 10:32=C2=A0Uhr:<= blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1px= #ccc solid;padding-left:1ex">Still no dice, sorry.=C2=A0 = I just tried the patched version with the original example:echo -n bar | xsel -i && \=C2=A0 emacs -Q = -eval \=C2=A0 "(insert (propertize \"foo\" 'f= ollow-link (lambda (pos) \"a\")))"Now when I click foo nothing happens in the buffer, = but there's an error message:Function mouse--down-1-may= be-follows-link returns invalid key sequenceI can't think of a reason why though :(M-x v= ersion:=C2=A0GNU Emacs 25.0.93.1 (x86_64-pc-linux-gnu, GTK+ Version 3.10.8)=On We= d, May 11, 2016 at 10:14 AM, Eli Zaretskii <eliz@gnu.org> wrote:<= br>> From: Philipp Stephani <p.stephani2@gmail.com= a>>
> Date: Tue, 10 May 2016 21:25:47 +0000
> Cc: 23288@d= ebbugs.gnu.org
>
>=C2=A0 Agreed. https://debbugs.gnu.org/cgi/= bugreport.cgi?bug=3D17887 might also be related.
>
> I've attached a new patch that should hopefully correct the behavi= or.
Thanks.=C2=A0 If no one objects in a week, please push to the master=
branch.
> From: Philipp Stephani <p.stephani2@gmail.com>
> Date: Tue, 10 May 2016 21:25:47 +0000
> Cc: 23288@d= ebbugs.gnu.org
>
>=C2=A0 Agreed. https://debbugs.gnu.org/cgi/= bugreport.cgi?bug=3D17887 might also be related.
>
> I've attached a new patch that should hopefully correct the behavi= or.
Thanks.=C2=A0 If no one objects in a week, please push to the master
branch.