Subject: bug#37774: 27.0.50; new :extend attribute broke visuals of all themes and other packages

From: Kévin Le Gouguec <[email-masked]>
Date: Thu, 17 Oct 2019 21:05:40 +0200

Andrey Orst <[email-masked]> writes:

> (defface foo...)
> (when (>= emacs-major-version 27)
>   (set-face-attribute foo... :extend t))

Unless I'm mistaken, this has the disadvantage of making Custom confused
as to who changed the face, i.e. M-x customize-face RET foo... RET will
say that the face was "CHANGED outside Customize".  For all intents and
purposes a package author may wish the face to be described as
"STANDARD" as long as no theming or user customization has been applied.

Maybe some backquote trickery may help?

--- magit-diff.el.bkp	2019-10-17 20:29:21.771892709 +0200
+++ magit-diff.el	2019-10-17 20:53:47.927829447 +0200
@@ -509,12 +509,14 @@
   :group 'magit-faces)
 
 (defface magit-diff-hunk-heading
-  '((((class color) (background light))
+  `((((class color) (background light))
      :background "grey80"
-     :foreground "grey30")
+     :foreground "grey30"
+     ,@(unless (version<= emacs-version "27") '(:extend t)))
     (((class color) (background dark))
      :background "grey25"
-     :foreground "grey70"))
+     :foreground "grey70"
+     ,@(unless (version<= emacs-version "27") '(:extend t))))
   "Face for diff hunk headings."
   :group 'magit-faces)

(I did not look for a way to factor out the (:extend t) into a leading
(default …) clause, but there ought to be a way to do it.)

This method should be usable by theme authors too, crufty as it looks…