Subject: bug#60423: 29.0.60; goto-address and shr/textsec don't play nicely together

From: Mike Kupfer <[email-masked]>
Date: Thu, 29 Dec 2022 19:59:05 -0800

View the HTML portion of the attached email in MH-E and Gnus.  Both will
display "https://fsf.org" in red and put a caution emoji after it,
because the link doesn't actually point to https://fsf.org.  Good so
far.

In Gnus, if you mouse over the link, the actual target appears in the
echo area.  And if you mouse over the caution emoji, you'll see text in
the echo area that tells you that the link target doesn't match the link
text.  Also good so far.

In MH-E, if you mouse over the link or emoji, you get text in the echo
area that tells you how to follow the link.  There's no explanation
given for the red text or the caution emoji, which is a bug IMO.

I tracked this down to MH-E's use of goto-address when displaying a
message (mh-display-msg > mh-show-addr > goto-address).

I can think of a couple ways to deal with this, but I'm not sure what
the right way forward is.  The simplest approach would be for
mh-display-msg to stop using goto-address.  I'm not happy with that
approach because it removes functionality that MH-E has had for awhile.  

A slightly more sophisticated approach would be to not use goto-address
when using shr to render the message.  That loses some functionality
(like the auto-linkification of email addresses), and it seems kind of
kludgey, but I suppose it's not too terrible.

Another possibility would be to make goto-address smarter, so that it
doesn't stomp on whatever it was that shr did to get the mouse-over
text.

I'm happy to take a stab at a fix, but I could use some guidance on the
right direction to go in.

thanks,
mike

PS. I've reproduced the problem with commit a14821d615; you can ignore
the "Repository revision" and "Repository branch" fields below.

In GNU Emacs 29.0.60 (build 4, x86_64-pc-linux-gnu, X toolkit, cairo
 version 1.16.0, Xaw scroll bars) of 2022-12-29 built on alto
Repository revision: f26689637923ac9b834a209e1bab09c779be212f
Repository branch: emacs-29-mdk
Windowing system distributor 'The X.Org Foundation', version 11.0.12011000
System Description: Debian GNU/Linux 11 (bullseye)

Configured using:
 'configure --prefix=/usr/new'

Configured features:
CAIRO FREETYPE GIF GLIB GMP GNUTLS GSETTINGS HARFBUZZ JPEG LIBSELINUX
LIBXML2 MODULES NOTIFY INOTIFY PDUMPER PNG SECCOMP SOUND THREADS TIFF
TOOLKIT_SCROLL_BARS X11 XDBE XIM XPM LUCID ZLIB

Important settings:
  value of $LC_TIME: C
  value of $LANG: en_US.UTF-8
  locale-coding-system: utf-8-unix

Major mode: MH-Folder

Minor modes in effect:
  hl-line-mode: t
  shell-dirtrack-mode: t
  delete-selection-mode: t
  global-eldoc-mode: t
  show-paren-mode: t
  mouse-wheel-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  buffer-read-only: t
  column-number-mode: t
  indent-tabs-mode: t
  transient-mark-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t

Load-path shadows:
None found.

Features:
(shadow mh-identity mh-letter emacsbug sort gnus-async gnus-bcklg
gnus-kill qp cl-extra help-mode gnus-ml disp-table url-http url-gw
url-cache url-auth url-handlers nnrss mm-url nndoc nndraft
network-stream nsm gnus-agent gnus-srvr nnvirtual nntp gnus-cache
textsec uni-scripts idna-mapping ucs-normalize uni-confusable
textsec-check mm-archive mail-extr mh-mime mule-util mh-thread mh-show
goto-addr gnus-cite mh-inc hl-line mh-tool-bar mh-acros mh-seq mh-xface
mh-utils mh-folder which-func imenu misearch multi-isearch crm thingatpt
cus-edit pp cus-start cus-load mdk-mail gnus-mh gnus-msg mh-comp mh-scan
mh-gnus gnus-dup nnmh gnus-score score-mode gnus-art mm-uu mml2015
mm-view mml-smime smime gnutls dig gnus-sum shr pixel-fill kinsoku
url-file svg dom browse-url url url-proxy url-privacy url-expand
url-methods url-history url-cookie generate-lisp-file url-domsuf
url-util url-parse auth-source cl-seq eieio eieio-core cl-macs json map
gv url-vars gnus-group gnus-undo gnus-start gnus-dbus dbus xml
gnus-cloud nnimap nnmail mail-source utf7 nnoo parse-time iso8601
gnus-spec gnus-int gnus-range gnus-win gnus nnheader range wid-edit mh-e
mh-buffers mh-loaddefs message sendmail mailcap yank-media puny dired
dired-loaddefs rfc822 mml mml-sec password-cache epa derived epg rfc6068
epg-config gnus-util text-property-search time-date mm-decode mm-bodies
mm-encode mail-parse rfc2231 rfc2047 rfc2045 mm-util ietf-drums
mail-prsvr mailabbrev mail-utils gmm-utils mailheader warnings server
noutline outline icons cc-mode cc-fonts cc-guess cc-menus cc-cmds
cc-styles cc-align cc-engine cc-vars cc-defs byte-opt bytecomp
byte-compile shell subr-x pcomplete comint ansi-osc ansi-color ring
xcscope advice delsel vc vc-dispatcher timeclock cl-loaddefs cl-lib
mdk-hacks rmc iso-transl tooltip cconv eldoc paren electric uniquify
ediff-hook vc-hooks lisp-float-type elisp-mode mwheel term/x-win x-win
term/common-win x-dnd tool-bar dnd fontset image regexp-opt fringe
tabulated-list replace newcomment text-mode lisp-mode prog-mode register
page tab-bar menu-bar rfn-eshadow isearch easymenu timer select
scroll-bar mouse jit-lock font-lock syntax font-core term/tty-colors
frame minibuffer nadvice seq simple cl-generic indonesian philippine
cham georgian utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao
korean japanese eucjp-ms cp51932 hebrew greek romanian slovak czech
european ethiopic indian cyrillic chinese composite emoji-zwj charscript
charprop case-table epa-hook jka-cmpr-hook help abbrev obarray oclosure
cl-preloaded button loaddefs theme-loaddefs faces cus-face macroexp
files window text-properties overlay sha1 md5 base64 format env
code-pages mule custom widget keymap hashtable-print-readable backquote
threads inotify dynamic-setting system-font-setting font-render-setting
cairo x-toolkit x multi-tty make-network-process emacs)

Memory information:
((conses 16 350237 71147)
 (symbols 48 23107 9)
 (strings 32 88955 27698)
 (string-bytes 1 2387295)
 (vectors 16 66600)
 (vector-slots 8 1547532 240746)
 (floats 8 253 414)
 (intervals 56 767 0)
 (buffers 976 22))