Subject: bug#39504: 27.0.60; [PATCH] eww/shr: Ensure faces of enclosing elements apply to <code> elements

From: Kévin Le Gouguec <[email-masked]>
Date: Sat, 08 Feb 2020 01:17:11 +0100

Patches with changelogs amended with this bug number:

>From 36629660e9adf4cd500b081e8b45c76cb1d8cb4d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?K=C3=A9vin=20Le=20Gouguec?= <[email-masked]>
Date: Sat, 8 Feb 2020 00:08:13 +0100
Subject: [PATCH] Ensure faces of enclosing elements apply to <code> elements
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

The default face overrides the attributes of every enclosing element.
E.g. with <a href="…">foo <code>bar</code> baz</a>, since shr applies
'default' top of 'shr-link', "bar" has neither a blue foreground nor
an underline.

* lisp/net/shr.el (shr-tag-code): Use a face that only sets relevant
attributes.

(Bug#39504)
---
 lisp/net/shr.el | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lisp/net/shr.el b/lisp/net/shr.el
index 241180d471..87106b0bd6 100644
--- a/lisp/net/shr.el
+++ b/lisp/net/shr.el
@@ -1438,7 +1438,7 @@ shr-tag-u
   (shr-fontize-dom dom 'underline))
 
 (defun shr-tag-code (dom)
-  (let ((shr-current-font 'default))
+  (let ((shr-current-font 'fixed-pitch))
     (shr-generic dom)))
 
 (defun shr-tag-tt (dom)
-- 
2.20.1

>From b648822ac4e401984f967fdc2d78e177697089ab Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?K=C3=A9vin=20Le=20Gouguec?= <[email-masked]>
Date: Sat, 8 Feb 2020 00:08:13 +0100
Subject: [PATCH] Introduce face for <code> elements
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

The default face overrides the attributes of every enclosing element.
E.g. with <a href="…">foo <code>bar</code> baz</a>, since shr applies
'default' top of 'shr-link', "bar" has neither a blue foreground nor
an underline.

* lisp/net/shr.el (shr-code): New face.
(shr-tag-code): Use it.

(Bug#39504)
---
 lisp/net/shr.el | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/lisp/net/shr.el b/lisp/net/shr.el
index 241180d471..1215fbddd0 100644
--- a/lisp/net/shr.el
+++ b/lisp/net/shr.el
@@ -142,6 +142,10 @@ shr-strike-through
   "Face for <s> elements."
   :version "24.1")
 
+(defface shr-code '((t :inherit fixed-pitch))
+  "Face for <code> elements."
+  :version "27.1")
+
 (defface shr-link
   '((t :inherit link))
   "Face for link elements."
@@ -1438,7 +1442,7 @@ shr-tag-u
   (shr-fontize-dom dom 'underline))
 
 (defun shr-tag-code (dom)
-  (let ((shr-current-font 'default))
+  (let ((shr-current-font 'shr-code))
     (shr-generic dom)))
 
 (defun shr-tag-tt (dom)
-- 
2.20.1