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

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