GNU bug report logs - #22157
left-clicking on a link: 2 browsers or a warning

Previous Next

Packages: emacs, gnus;

Reported by: Mike Kupfer <m.kupfer <at> acm.org>

Date: Sun, 13 Dec 2015 05:34:02 UTC

Severity: normal

Done: Katsumi Yamaoka <yamaoka <at> jpl.org>

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 22157 in the body.
You can then email your comments to 22157 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 bugs <at> gnus.org:
bug#22157; Package gnus. (Sun, 13 Dec 2015 05:34:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Mike Kupfer <m.kupfer <at> acm.org>:
New bug report received and forwarded. Copy sent to bugs <at> gnus.org. (Sun, 13 Dec 2015 05:34:02 GMT) Full text and rfc822 format available.

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

From: Mike Kupfer <m.kupfer <at> acm.org>
To: submit <at> debbugs.gnu.org (The Gnus Bugfixing Girls + Boys)
Subject: left-clicking on a link: 2 browsers or a warning
Date: Sat, 12 Dec 2015 21:33:13 -0800
Gnus v5.13
GNU Emacs 25.0.50.2 (x86_64-unknown-linux-gnu, X toolkit, Xaw scroll bars)
(commit 251fac2)

I can reliable reproduce the following issues with "emacs -Q".  (I'm
mentioning them in the same bug report because I suspect they're
related.)

When viewing an HTML email using shr, when I left-click on a link, Gnus
starts 2 browsers and directs each to the URL for the link.

When viewing a plaintext email that contains a URL, when I left-click
on the URL, Gnus starts a browser for that URL okay, but I also get a
message like

  Buffer is read-only: #<buffer *Article gnu.emacs.gnus*>

In both cases (HTML, plaintext) middle-clicking on the link/URL works
okay.

With Emacs 24.5, I only get 1 browser (HTML email) and no error message
(plaintext email).




bug reassigned from package 'gnus' to 'emacs'. Request was from Mike Kupfer <m.kupfer <at> acm.org> to control <at> debbugs.gnu.org. (Mon, 01 Feb 2016 01:15:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#22157; Package emacs. (Mon, 01 Feb 2016 01:20:02 GMT) Full text and rfc822 format available.

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

From: Mike Kupfer <m.kupfer <at> acm.org>
To: 22157 <at> debbugs.gnu.org
Subject: still present in 25.0.90
Date: Sun, 31 Jan 2016 17:19:46 -0800
I'm afraid that I'm still seeing this problem in 25.0.90.

mike




bug reassigned from package 'emacs' to 'emacs,gnus'. Request was from Glenn Morris <rgm <at> gnu.org> to control <at> debbugs.gnu.org. (Mon, 01 Feb 2016 16:59:01 GMT) Full text and rfc822 format available.

bug No longer marked as found in versions 5.13. Request was from Glenn Morris <rgm <at> gnu.org> to control <at> debbugs.gnu.org. (Mon, 01 Feb 2016 16:59:01 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org, bugs <at> gnus.org:
bug#22157; Package emacs,gnus. (Thu, 28 Apr 2016 03:48:01 GMT) Full text and rfc822 format available.

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

From: Mike Kupfer <m.kupfer <at> acm.org>
To: Rainer M Krug <Rainer <at> krugs.de>
Cc: 22157 <at> debbugs.gnu.org, ding <at> gnus.org
Subject: Re: html renderer shr - Links open twice in external browser
Date: Wed, 27 Apr 2016 20:47:51 -0700
Rainer M Krug wrote:

> I have set my html renderer to shr which works, but whenever I click a
> link, it opens twice in the external browser.
> 
> I want it to open in the external browser - that is fine, but only once.
> 
> This started only recently, but I can not pinpoint the exact time when
> this started.

Yes, I noticed this late last year with Emacs 25.  Haven't seen it with
Emacs 24.5 (using the Gnus that comes with it).  It's still present in
25.0.92 (I haven't had time to try out .93 yet).

http://debbugs.gnu.org/cgi/bugreport.cgi?bug=22157

mike




Information forwarded to bug-gnu-emacs <at> gnu.org, bugs <at> gnus.org:
bug#22157; Package emacs,gnus. (Thu, 28 Apr 2016 07:44:02 GMT) Full text and rfc822 format available.

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

From: Rainer M Krug <Rainer <at> krugs.de>
To: Mike Kupfer <m.kupfer <at> acm.org>
Cc: 22157 <at> debbugs.gnu.org, ding <at> gnus.org
Subject: Re: bug#22157: html renderer shr - Links open twice in external
 browser
Date: Thu, 28 Apr 2016 09:43:04 +0200
[Message part 1 (text/plain, inline)]
Mike Kupfer <m.kupfer <at> acm.org> writes:

> Rainer M Krug wrote:
>
>> I have set my html renderer to shr which works, but whenever I click a
>> link, it opens twice in the external browser.
>> 
>> I want it to open in the external browser - that is fine, but only once.
>> 
>> This started only recently, but I can not pinpoint the exact time when
>> this started.
>
> Yes, I noticed this late last year with Emacs 25.  Haven't seen it with
> Emacs 24.5 (using the Gnus that comes with it).  It's still present in
> 25.0.92 (I haven't had time to try out .93 yet).
>
> http://debbugs.gnu.org/cgi/bugreport.cgi?bug=22157

Thanks for the info,

Rainer


>
> mike
>
>
>
>

-- 
Rainer M. Krug
email: Rainer<at>krugs<dot>de
PGP: 0x0F52F982
[signature.asc (application/pgp-signature, inline)]

Information forwarded to bug-gnu-emacs <at> gnu.org, bugs <at> gnus.org:
bug#22157; Package emacs,gnus. (Thu, 28 Apr 2016 17:44:01 GMT) Full text and rfc822 format available.

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

From: Mike Kupfer <m.kupfer <at> acm.org>
To: 22157 <at> debbugs.gnu.org
Subject: problem only seen with Gnus, not MH-E
Date: Thu, 28 Apr 2016 10:43:07 -0700
I did a little more experimenting this morning, and I only see this
problem with Gnus.  Although I have MH-E configured to use shr, too,
left-click works fine for it, with both HTML and plaintext messages.

(Still 25.0.92.)

mike




Information forwarded to bug-gnu-emacs <at> gnu.org, bugs <at> gnus.org:
bug#22157; Package emacs,gnus. (Mon, 02 May 2016 07:32:02 GMT) Full text and rfc822 format available.

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

From: Katsumi Yamaoka <yamaoka <at> jpl.org>
To: 22157 <at> debbugs.gnu.org
Subject: Re: bug#22157: html renderer shr - Links open twice in external
 browser
Date: Mon, 02 May 2016 16:31:34 +0900
(Last Subject: problem only seen with Gnus, not MH-E)

I don't know why it doesn't happen with MH-E, though.  I think
this is why a link opens twice:

・If a link has an image, there are two keymaps `shr-map' and
  `shr-image-map'.  `shr-map' binds `mouse-2' to `shr-browse-url',
  and `follow-link' to `mouse-face'; `shr-image-map' has a copy
  of `shr-map' bindings.
・The `follow-link' binding responds to the `mouse-1' button if
  `mouse-1-click-follows-link' is non-nil (the default).

A fix would be:

--- shr.el~	2016-04-24 22:03:10.675591200 +0000
+++ shr.el	2016-05-02 07:23:19.038316700 +0000
@@ -191,7 +191,7 @@
     map))
 
 (defvar shr-image-map
-  (let ((map (copy-keymap shr-map)))
+  (let ((map (make-sparse-keymap)))
     (when (boundp 'image-map)
       (set-keymap-parent map image-map))
     map))

I realized why I wasn't troubled with such a problem is that
I've set `mouse-1-click-follows-link' to nil years ago. ;-)




Information forwarded to bug-gnu-emacs <at> gnu.org, bugs <at> gnus.org:
bug#22157; Package emacs,gnus. (Mon, 02 May 2016 10:00:02 GMT) Full text and rfc822 format available.

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

From: Katsumi Yamaoka <yamaoka <at> jpl.org>
To: 22157 <at> debbugs.gnu.org
Subject: Re: bug#22157: html renderer shr - Links open twice in external
 browser
Date: Mon, 02 May 2016 18:59:51 +0900
On Mon, 02 May 2016 16:31:34 +0900, Katsumi Yamaoka wrote:
> I think this is why a link opens twice:

> ・If a link has an image, there are two keymaps `shr-map' and
>   `shr-image-map'.  `shr-map' binds `mouse-2' to `shr-browse-url',
>   and `follow-link' to `mouse-face'; `shr-image-map' has a copy
>   of `shr-map' bindings.

No.  There are three keymaps.  The other one is that of the widget
button, that `mm-convert-shr-links' creates.  This might be the
reason why it doesn't happen with MH-E.

> ・The `follow-link' binding responds to the `mouse-1' button if
>   `mouse-1-click-follows-link' is non-nil (the default).

But I don't know why it responds to a single `mouse-1' click twice
so far.  It might otherwise not be the cause.

> A fix would be:

> --- shr.el~	2016-04-24 22:03:10.675591200 +0000
> +++ shr.el	2016-05-02 07:23:19.038316700 +0000
> @@ -191,7 +191,7 @@
>      map))

>  (defvar shr-image-map
> -  (let ((map (copy-keymap shr-map)))
> +  (let ((map (make-sparse-keymap)))
>      (when (boundp 'image-map)
>        (set-keymap-parent map image-map))
>      map))

This fixes the problem anyway.
I tried making a simple test program that reproduce the `twice'
problem, but haven't succeeded in it yet.




Information forwarded to bug-gnu-emacs <at> gnu.org, bugs <at> gnus.org:
bug#22157; Package emacs,gnus. (Fri, 06 May 2016 01:38:02 GMT) Full text and rfc822 format available.

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

From: Katsumi Yamaoka <yamaoka <at> jpl.org>
To: 22157 <at> debbugs.gnu.org
Subject: Re: bug#22157: html renderer shr - Links open twice in external
 browser
Date: Fri, 06 May 2016 10:37:07 +0900
The change 72166f2f3dba18f1217c666574032f5a0351ed65 seems to have
fixed this bug.

On Tue, 03 May 2016 06:39:44 +0000, Martin Rudalics wrote:
>     Bind `widget-button-click' to mouse-1/-2 instead of down-mouse-1/-2

>     * lisp/wid-edit.el (widget-keymap): Bind `widget-button-click'
>     to mouse-1/-2 instead of down-mouse-1/-2.  Suggested by Stefan
>     Monnier.  (Bug#19185, Bug#20398)

cf. <http://article.gmane.org/gmane.emacs.diffs/135579>

To try the old `widget-keymap' definition to reproduce the bug,
I needed to eval the following form, that exists in gnus-art.el,
after reverting the `widget-keymap' definition:

(set-keymap-parent gnus-article-mode-map widget-keymap)

With this, I learned that `set-keymap-parent' uses a copy of
a parent keymap, i.e., a change made in a parent keymap has no
effect on *this* keymap.




Information forwarded to bug-gnu-emacs <at> gnu.org, bugs <at> gnus.org:
bug#22157; Package emacs,gnus. (Fri, 06 May 2016 08:44:01 GMT) Full text and rfc822 format available.

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

From: Nicolas Petton <nicolas <at> petton.fr>
To: Katsumi Yamaoka <yamaoka <at> jpl.org>, 22157 <at> debbugs.gnu.org
Cc: 22157-done <at> debbugs.gnu.org
Subject: Re: bug#22157: html renderer shr - Links open twice in external
 browser
Date: Fri, 06 May 2016 10:43:09 +0200
[Message part 1 (text/plain, inline)]
Katsumi Yamaoka <yamaoka <at> jpl.org> writes:

> The change 72166f2f3dba18f1217c666574032f5a0351ed65 seems to have
> fixed this bug.

I'm closing it then.
[signature.asc (application/pgp-signature, inline)]

Reply sent to Nicolas Petton <nicolas <at> petton.fr>:
You have taken responsibility. (Fri, 06 May 2016 08:44:01 GMT) Full text and rfc822 format available.

Notification sent to Mike Kupfer <m.kupfer <at> acm.org>:
bug acknowledged by developer. (Fri, 06 May 2016 08:44:02 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Fri, 03 Jun 2016 11:24:04 GMT) Full text and rfc822 format available.

bug unarchived. Request was from Stephen Berman <stephen.berman <at> gmx.net> to control <at> debbugs.gnu.org. (Fri, 10 Jun 2016 09:19:01 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org, bugs <at> gnus.org:
bug#22157; Package emacs,gnus. (Fri, 10 Jun 2016 09:24:01 GMT) Full text and rfc822 format available.

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

From: Stephen Berman <stephen.berman <at> gmx.net>
To: 22157 <at> debbugs.gnu.org
Subject: Re: bug#22157: html renderer shr - Links open twice in external
 browser
Date: Fri, 10 Jun 2016 11:23:04 +0200
[resending to the bug list, after unarchiving the bug]

On Fri, 10 Jun 2016 17:35:04 +0900 Katsumi Yamaoka <yamaoka <at> jpl.org> wrote:

> On Fri, 06 May 2016 10:43:09 +0200, Nicolas Petton wrote:
>> Katsumi Yamaoka <yamaoka <at> jpl.org> writes:
>>> The change 72166f2f3dba18f1217c666574032f5a0351ed65 seems to have
>>> fixed this bug.
>> I'm closing it then.
>
> The bug has come back by the change[1] done in master two hours
> ago in relation to bug#23571.  I vaguely guessed this is due to
> something bad in Gnus' way[2] but haven't resolved yet.
>
> Thanks.
>
> [1] Revert "Bind `widget-button-click' to mouse-1/-2 instead of down-mouse-1/-2"
> <http://lists.gnu.org/archive/html/emacs-diffs/2016-06/msg00069.html>
>
> [2] There are three keymaps in the article buffer
> <https://lists.gnu.org/archive/html/bug-gnu-emacs/2016-05/msg00074.html>

I didn't know this bug had also been connected with commit 72166f.  I
just tried to reproduce it on my master branch, which still has the
commit (I have not yet updated since Martin reverted it), and here are
my results (the indented lines are quotes from the OP):

   When viewing an HTML email using shr, when I left-click on a link, Gnus
   starts 2 browsers and directs each to the URL for the link.

I still see this on master with commit 72166f (in my case it's two tabs
on one browser instance).

   When viewing a plaintext email that contains a URL, when I left-click
   on the URL, Gnus starts a browser for that URL okay, but I also get a
   message like
   
     Buffer is read-only: #<buffer *Article gnu.emacs.gnus*>

I do not see this on master with commit 72166f, but I do see it without
that commit.

   In both cases (HTML, plaintext) middle-clicking on the link/URL works
   okay.

For me too on master with commit 72166f.

In short, the now reverted commit does not completely fix this bug for
me.  And since it introduced bug#23571, which for me is more annoying
than bug#22157, I would prefer it not to be simply recomitted; hopefully
a better fix can be found.

Steve Berman




Did not alter fixed versions and reopened. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Fri, 10 Jun 2016 09:42:01 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org, bugs <at> gnus.org:
bug#22157; Package emacs,gnus. (Fri, 10 Jun 2016 10:30:02 GMT) Full text and rfc822 format available.

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

From: Katsumi Yamaoka <yamaoka <at> jpl.org>
To: 22157 <at> debbugs.gnu.org
Cc: Stephen Berman <stephen.berman <at> gmx.net>, Mike Kupfer <m.kupfer <at> acm.org>
Subject: Re: bug#22157: html renderer shr - Links open twice in external
 browser
Date: Fri, 10 Jun 2016 17:35:04 +0900
On Fri, 06 May 2016 10:43:09 +0200, Nicolas Petton wrote:
> Katsumi Yamaoka <yamaoka <at> jpl.org> writes:
>> The change 72166f2f3dba18f1217c666574032f5a0351ed65 seems to have
>> fixed this bug.
> I'm closing it then.

The bug has come back by the change[1] done in master two hours
ago in relation to bug#23571.  I vaguely guessed this is due to
something bad in Gnus' way[2] but haven't resolved yet.

Thanks.

[1] Revert "Bind `widget-button-click' to mouse-1/-2 instead of down-mouse-1/-2"
<http://lists.gnu.org/archive/html/emacs-diffs/2016-06/msg00069.html>

[2] There are three keymaps in the article buffer
<https://lists.gnu.org/archive/html/bug-gnu-emacs/2016-05/msg00074.html>




Information forwarded to bug-gnu-emacs <at> gnu.org, bugs <at> gnus.org:
bug#22157; Package emacs,gnus. (Fri, 10 Jun 2016 13:59:02 GMT) Full text and rfc822 format available.

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

From: martin rudalics <rudalics <at> gmx.at>
To: Stephen Berman <stephen.berman <at> gmx.net>, 22157 <at> debbugs.gnu.org
Subject: Re: bug#22157: html renderer shr - Links open twice in external
 browser
Date: Fri, 10 Jun 2016 15:58:42 +0200
> I didn't know this bug had also been connected with commit 72166f.  I
> just tried to reproduce it on my master branch, which still has the
> commit (I have not yet updated since Martin reverted it), and here are
> my results (the indented lines are quotes from the OP):
>
>     When viewing an HTML email using shr, when I left-click on a link, Gnus
>     starts 2 browsers and directs each to the URL for the link.

One for the down and one for the up event, I suppose.

> I still see this on master with commit 72166f (in my case it's two tabs
> on one browser instance).
>
>     When viewing a plaintext email that contains a URL, when I left-click
>     on the URL, Gnus starts a browser for that URL okay, but I also get a
>     message like
>
>       Buffer is read-only: #<buffer *Article gnu.emacs.gnus*>

The typical attempt to yank text in that buffer.  IIRC this was my major
concern (in *info* buffers) but I didn't find the corresponding thread
any more :-(

> I do not see this on master with commit 72166f, but I do see it without
> that commit.
>
>     In both cases (HTML, plaintext) middle-clicking on the link/URL works
>     okay.
>
> For me too on master with commit 72166f.

IIRC all these bugs were only triggered by mouse-1 events.

> In short, the now reverted commit does not completely fix this bug for
> me.  And since it introduced bug#23571, which for me is more annoying
> than bug#22157, I would prefer it not to be simply recomitted; hopefully
> a better fix can be found.

Do we know whether mouse-1 ever worked correctly?

martin




Information forwarded to bug-gnu-emacs <at> gnu.org, bugs <at> gnus.org:
bug#22157; Package emacs,gnus. (Mon, 13 Jun 2016 01:23:02 GMT) Full text and rfc822 format available.

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

From: Katsumi Yamaoka <yamaoka <at> jpl.org>
To: 22157 <at> debbugs.gnu.org
Subject: Re: bug#22157: html renderer shr - Links open twice in external
 browser
Date: Mon, 13 Jun 2016 10:22:20 +0900
On Fri, 10 Jun 2016 15:58:42 +0200, martin rudalics wrote:
>> When viewing an HTML email using shr, when I left-click on a link, Gnus
>> starts 2 browsers and directs each to the URL for the link.

> One for the down and one for the up event, I suppose.

Left-click causes invoking `widget-button-click' by the mouse-1
event, and `shr-browse-url' by the mouse-2 event 0.6 sec after
(I tested it by adding a logger code to each function).  But
middle-click invokes only `widget-button-click' by down-mouse-2.
At the link position, there are two keymaps[1]:

There is an overlay here:
 From 876 to 882
  button               url-link (widget)Top
  evaporate            t
  face                 nil
  follow-link          nil
  help-echo            [Show]
	-> "https://www.amazon.co.jp/..."
  keymap               [Show]
	-> (keymap ...(mouse-2 . shr-browse-url) (follow-link . mouse-face)...
  mouse-face           (highlight)
  pointer              hand

There are text properties here:
  face                 (variable-pitch shr-link (:foreground "#333333")...
  follow-link          t
  help-echo            [Show]
	-> "https://www.amazon.co.jp/..."
  keymap               [Show]
	-> (keymap ...(mouse-2 . shr-browse-url) (follow-link . mouse-face)...
  local-map            nil
  mouse-face           highlight
  shr-url              [Show]
	-> (the same as the help-echo string)

IIUC, the overlay is what `mm-convert-shr-links' adds, and the
text properties are what `shr-urlify' adds.  Though Lars wrote
in 2013-06-17 as follows, is it really necessary?

 * mm-decode.el (mm-convert-shr-links): Override the shr local map, so
 that Gnus commands work.

[1] I wrote "there are three keymaps" last month but it's wrong,
probably.




Reply sent to Katsumi Yamaoka <yamaoka <at> jpl.org>:
You have taken responsibility. (Wed, 22 Jun 2016 10:42:02 GMT) Full text and rfc822 format available.

Notification sent to Mike Kupfer <m.kupfer <at> acm.org>:
bug acknowledged by developer. (Wed, 22 Jun 2016 10:42:02 GMT) Full text and rfc822 format available.

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

From: Katsumi Yamaoka <yamaoka <at> jpl.org>
To: 22157-done <at> debbugs.gnu.org
Subject: Re: bug#22157: html renderer shr - Links open twice in external
 browser
Date: Wed, 22 Jun 2016 19:41:41 +0900
On Mon, 13 Jun 2016 10:22:20 +0900, Katsumi Yamaoka wrote:
> Left-click causes invoking `widget-button-click' by the mouse-1
> event, and `shr-browse-url' by the mouse-2 event 0.6 sec after
> (I tested it by adding a logger code to each function).  But
> middle-click invokes only `widget-button-click' by down-mouse-2.
> At the link position, there are two keymaps[1]:
[...]
> [1] I wrote "there are three keymaps" last month but it's wrong,
> probably.

No, that's right.  I'm sorry for flip-flopping; the third one is
`gnus-article-mode-map', of which the parent is `widget-keymap'.
Anyway I found the solution for this bug at last.  I verified
the problem happens with emacs-25, not only master, so I've
committed the fix to emacs-25:

git diff 8297331..ea512a7

Regards,




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Wed, 20 Jul 2016 11:24:04 GMT) Full text and rfc822 format available.

This bug report was last modified 8 years and 335 days ago.

Previous Next


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