Subject: Re: bug#22157: html renderer shr - Links open twice in external browser

From: Katsumi Yamaoka <[email-masked]>
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.