From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Mauro Aranda Newsgroups: gmane.emacs.bugs Subject: bug#15682: 24.3.50; `:link' in `defgroup' does not respect `mouse-1-click-follows-link' Date: Fri, 23 Aug 2019 17:41:45 -0300 Message-ID: References: <203eab8f-376f-423b-8347-3a0d354bb3e3@default> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="000000000000549e420590ced6c8" Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="135161"; mail-complaints-to="usenet@blaine.gmane.org" Cc: Lars Ingebrigtsen To: 15682@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Fri Aug 23 22:43:57 2019 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1i1GPc-000Z0q-NW for geb-bug-gnu-emacs@m.gmane.org; Fri, 23 Aug 2019 22:43:56 +0200 Original-Received: from localhost ([::1]:34072 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i1GPa-0005Nc-QG for geb-bug-gnu-emacs@m.gmane.org; Fri, 23 Aug 2019 16:43:54 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:57967) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i1GOp-0005MF-QA for bug-gnu-emacs@gnu.org; Fri, 23 Aug 2019 16:43:09 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1i1GOm-00009y-5W for bug-gnu-emacs@gnu.org; Fri, 23 Aug 2019 16:43:06 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:60687) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1i1GOl-00009o-An for bug-gnu-emacs@gnu.org; Fri, 23 Aug 2019 16:43:04 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1i1GOj-0000Zg-TD for bug-gnu-emacs@gnu.org; Fri, 23 Aug 2019 16:43:03 -0400 X-Loop: help-debbugs@gnu.org In-Reply-To: <203eab8f-376f-423b-8347-3a0d354bb3e3@default> Resent-From: Mauro Aranda Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 23 Aug 2019 20:43:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 15682 X-GNU-PR-Package: emacs Original-Received: via spool by 15682-submit@debbugs.gnu.org id=B15682.15665929252134 (code B ref 15682); Fri, 23 Aug 2019 20:43:01 +0000 Original-Received: (at 15682) by debbugs.gnu.org; 23 Aug 2019 20:42:05 +0000 Original-Received: from localhost ([127.0.0.1]:41275 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1i1GNo-0000YM-RG for submit@debbugs.gnu.org; Fri, 23 Aug 2019 16:42:05 -0400 Original-Received: from mail-lj1-f171.google.com ([209.85.208.171]:44430) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1i1GNn-0000Xs-FW for 15682@debbugs.gnu.org; Fri, 23 Aug 2019 16:42:04 -0400 Original-Received: by mail-lj1-f171.google.com with SMTP id e24so10001443ljg.11 for <15682@debbugs.gnu.org>; Fri, 23 Aug 2019 13:42:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:from:date:message-id:subject:to:cc; bh=nYKcYuNF6uhSQKgFtVNRna5co8/mpEk0NdohRNfeOzg=; b=sGyvozAzeAu1cndB0s+DIsIz3ksxBV5wcFJ4aq3FqZ88B4RYwf/6s/MxBRsEun42Wp lhEzNcel8wsIcurR9NjpOqBp4HJ5QNPR7LvLEylT+DfZzBHsojQz8dESRJifmWt8VoVF 0fizfIycC6YDCDBqL4yxeTj9DPYk8J474qziqb081fv0x4KMDKbPIM5qq9ac5qeBSC7H 56nZgKBbAlOFfV/SYXoWFl4aImVZ7HUFeCs2sejDjh+23QkOmjjKMIGlYu8UuZEv7+c5 x8cRGX6pqb5+uwigagFs9nzoETvauWb7x46sEQEh3cUcsCNgA/iYKZEnx2P/vDR8AM5M EZQg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to:cc; bh=nYKcYuNF6uhSQKgFtVNRna5co8/mpEk0NdohRNfeOzg=; b=s3e/mkZOPIO/1FrLwps9wiQ9WhR8eY0XrqOqExf9XLKXH7V/cjrKy4/60zjTEzbVxM C+q18+v98MASnZ2jhBodPGV6rVDFhnRqXHXZNDCA5uqxy6QpqRwNcsPToqPaJZnjwwPZ hZK30TWF7A1BOg+OzbXpOxmZW8f/AUNuODmNz4XdwVo68E8okLjt5Vdj3xq0x9xYp5So Xj18gp8O5eV5S8vq+7Wy80tHUZveRn/J5gIyiAbHF6t/WfEss/sxIxjOJ1Q2QyIVKBna Hi6uvAtXupV1uHDeOaQFCJclaBIakoJVBQgPX7qmaayQHplswr8xRnQMfARigGI6cxsA JfKw== X-Gm-Message-State: APjAAAXviyovohpbyCts3RFPP8BLtVFBkEo2Y61mv4QwPWD/+NuQT4HE xhh91IeGqYHVaBc2d1ZWRWk1dJPzKaTssmLc4nNUvrP5GmY= X-Google-Smtp-Source: APXvYqwnc5dq8p3aTBG8IYqNXSmVIzbabKSm+b/IavgF5Qof+7k6QzB6kDpJNBN9qsS/ofRFHZEZW354DSI6GWZNQDM= X-Received: by 2002:a2e:a310:: with SMTP id l16mr3366526lje.47.1566592917041; Fri, 23 Aug 2019 13:41:57 -0700 (PDT) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.51.188.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:165729 Archived-At: --000000000000549e420590ced6c8 Content-Type: multipart/alternative; boundary="000000000000549e400590ced6c6" --000000000000549e400590ced6c6 Content-Type: text/plain; charset="UTF-8" I took a look at this bug and it turned out to be really tricky. So I did all the research I could, to try to find a good fix. Because the widget-button-click code was written before the addition of mouse-1-click-follows-link, there is some work to be done to adapt it. Even though there were some attempts [1], they weren't enough. The attached patch tries to fix this bug, while trying to not change too much of the code of the widget library. It introduces a keymap for the link widgets, and only binds mouse-2 events. Since widget-button-click isn't changed, it has to bind down-mouse-2 too. In this fix, I also have been careful to not reintroduce bugs that have come up by changing the keybindings in the widget-keymap, such as here: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=23571 I investigated the emacs sources, and have noticed that this patch could cause problems with three pieces of code: 1) recentf.el: Because of Bug#22434, puts a nil :follow-link property to the link widget. https://debbugs.gnu.org/cgi/bugreport.cgi?bug=22434 The patch would make that mouse-1 isn't translated to mouse-2, but since this was a workaround, changing this code would be OK, I think. Without overriding :follow-link, I have checked that recentf.el works like it should, with this patch applied. 2) epa.el: Typing M-x epa-encrypt-file brings up a *Keys* buffer. This buffer has clickable text: [Cancel] and [OK]. The epa code create this as a link widget, and when mouse-1-click-follows-link is nil, this text becomes not responsive with mouse-1. I'd say this are more buttons than links, so a fix for it (if it is considered it needs fixing) would be to turn them into push-button widgets. 3) mh-mime.el: I have never used MH-E. But there is some code in mh-mime.el that creates a link widget, with an action mh-widget-press-button, and it looks like it has a keymap of its own. I don't know if the behavior could change here. I haven't found any other code in the Emacs sources that could have problems. And fixing this would make code that depends on the link widgets to behave as expected, when mouse-1-click-follows-link is customized to a nil value. So I think it would be good to fix this. [1] https://lists.gnu.org/archive/html/emacs-devel/2008-03/msg01312.html --000000000000549e400590ced6c6 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
I took a look at this bug and it turned out to be really t= ricky.=C2=A0 So I did
all the research I could, to try to find a good fi= x.

Because the widget-button-click code was written before the addit= ion of
mouse-1-click-follows-link, there is some work to be done to adap= t it.=C2=A0 Even
though there were some attempts [1], they weren't e= nough.

The attached patch tries to fix this bug, while trying to not= change too much
of the code of the widget library.=C2=A0 It introduces = a keymap for the link widgets,
and only binds mouse-2 events.=C2=A0 Sinc= e widget-button-click isn't changed, it
has to bind down-mouse-2 too= .=C2=A0 In this fix, I also have been careful to not
reintroduce bugs th= at have come up by changing the keybindings in the
widget-keymap, such a= s here: h= ttps://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D23571

I investiga= ted the emacs sources, and have noticed that this patch could cause
prob= lems with three pieces of code:

1) recentf.el: Because of Bug#22434,= puts a nil :follow-link property to the
link widget. =C2=A0https://debbugs.gnu.o= rg/cgi/bugreport.cgi?bug=3D22434
The patch would make that mouse-1 i= sn't translated to mouse-2, but since this
was a workaround, changin= g this code would be OK, I think.=C2=A0 Without
overriding :follow-link,= I have checked that recentf.el works like it should,
with this patch ap= plied.

2) epa.el: Typing M-x epa-encrypt-file brings up a *Keys* buf= fer.=C2=A0 This buffer
has clickable text: [Cancel] and [OK].=C2=A0 The = epa code create this as a link
widget, and when mouse-1-click-follo= ws-link is nil, this text becomes not
responsive with mouse-= 1.=C2=A0 I'd say this are more buttons than links,
so a fix f= or it (if it is considered it needs fixing) would be to turn them into
push-button widgets.

3) mh-mime.el: I have never used MH= -E.=C2=A0 But there is some code in mh-mime.el
that creates a link widge= t, with an action mh-widget-press-button, and it
looks like it has a key= map of its own.=C2=A0 I don't know if the behavior could
change here= .

I haven't found any other code in the Emacs sources that could= have problems.
And fixing this would make code that depends on the link= widgets to behave as
expected, when mouse-1-click-follows-link is custo= mized to a nil value.=C2=A0 So I
think it would be good to fix this.
=
[1] https://lists.gnu.org/archive/html/emacs-devel/2008-03/msg013= 12.html

--000000000000549e400590ced6c6-- --000000000000549e420590ced6c8 Content-Type: text/x-patch; charset="US-ASCII"; name="0001-Make-link-widgets-obey-mouse-1-click-follows-link.patch" Content-Disposition: attachment; filename="0001-Make-link-widgets-obey-mouse-1-click-follows-link.patch" Content-Transfer-Encoding: base64 Content-ID: X-Attachment-Id: f_jzokut0o0 RnJvbSBkNDBmOGExZmEzMGZjYzY3NDQ0YjZhZmZmZDgxNDlkOWU5YjlhZjFkIE1vbiBTZXAgMTcg MDA6MDA6MDAgMjAwMQpGcm9tOiBNYXVybyBBcmFuZGEgPG1hdXJvb2FyYW5kYUBnbWFpbC5jb20+ CkRhdGU6IFR1ZSwgMjAgQXVnIDIwMTkgMjA6MzI6NDEgLTAzMDAKU3ViamVjdDogW1BBVENIXSBN YWtlIGxpbmsgd2lkZ2V0cyBvYmV5IG1vdXNlLTEtY2xpY2stZm9sbG93cy1saW5rCgoqIGxpc3Av d2lkLWVkaXQuZWwgKHdpZGdldC1saW5rLWtleW1hcCk6IE5ldyB2YXJpYWJsZSwgYSBrZXltYXAg dG8gdXNlCmluc2lkZSBhIGxpbmsgd2lkZ2V0LgooJ2xpbmsgd2lkZ2V0KTogUmVzdG9yZSB0aGUg OmZvbGxvdy1saW5rIHByb3BlcnR5IGFuZCBhZGQgd2lkZ2V0LWxpbmsta2V5bWFwCmFzIHRoZSA6 a2V5bWFwIHByb3BlcnR5LiAgKEJ1ZyMxNTY4MikKLS0tCiBsaXNwL3dpZC1lZGl0LmVsIHwgMTkg KysrKysrKysrKysrLS0tLS0tLQogMSBmaWxlIGNoYW5nZWQsIDEyIGluc2VydGlvbnMoKyksIDcg ZGVsZXRpb25zKC0pCgpkaWZmIC0tZ2l0IGEvbGlz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