Subject: bug#49433: 28.0.50; Faulty list of faces in shr-tag-h1

From: Protesilaos Stavrou <[email-masked]>
Date: Tue, 06 Jul 2021 10:37:12 +0300

In 'shr.el' we find these:

    (defun shr-tag-h1 (dom)
      (shr-heading dom (if shr-use-fonts
                   '(variable-pitch (:height 1.3 :weight bold))
                 'bold)))

    (defun shr-tag-h2 (dom)
      (shr-heading dom 'bold))

The intent is to make h1 headings use 'variable-pitch', however this
happens regardless, as can be noticed in other headings, such as h2 for
rendered documents.  As such, 'shr-tag-h1' creates duplication of the
'variable-pitch' entry.

Steps to reproduce on emacs -Q:

+ M-x eww RET https://www.gnu.org/software/emacs/

+ Go to the h1 heading that reads "GNU Emacs".

+ M-x describe-char

+ In the resulting Help buffer, notice this:

    (variable-pitch (variable-pitch (:height 1.3 :weight bold)))

+ The button that references that anonymous face does not provide a Help
  buffer with accurate information as to what attributes are in effect.
  Instead, it only lists the attributes of 'variable-pitch'.

+ Compare that to the information we get from the next heading, "An
  extensible, customizable, free/libre text editor — and more.", which
  accurately shows both of the faces that are in effect.

To fix the issue, we need to pass a face directly, without combining it
with 'variable-pitch'.  Just like 'shr-tag-h2'.  In a separate report, I
provide a patch that does that and adds new faces for all heading
elements (using 'defface' instead of hardcoding values).

Thank you!

-- 
Protesilaos Stavrou
https://protesilaos.com