summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDmitry Gutov <dgutov@yandex.ru>2019-12-10 02:11:15 +0200
committerDmitry Gutov <dgutov@yandex.ru>2019-12-10 02:16:44 +0200
commit58fb4c3e68a4a42ad491d0fa2c084e5c39942e2b (patch)
treeefe7a9e6a1b8f76cee65ecd59eb00d9d1e0d1838
parentd8d537e17349c02d981eabd92c78f60f73354798 (diff)
downloademacs-58fb4c3e68a4a42ad491d0fa2c084e5c39942e2b.tar.gz
Make ':extend' inherited from default spec unless overridden
* lisp/faces.el (face-spec-recalc): Handle the :extend attribute specially and always inherit it from the default spec unless overwritten in a theme (bug#37774). * test/lisp/faces-tests.el (faces--test-data-dir): New variable. (faces--test-extend-with-themes): Use test themes instead of ones from etc/themes. Update expected values. * test/data/themes/faces-test-dark-theme.el: New file. * test/data/themes/faces-test-light-theme.el: New file. * doc/lispref/display.texi (Face Attributes): Update the description of ':extend'. * etc/NEWS: Update the entry for ':extend'. * etc/themes/adwaita-theme.el: * etc/themes/deeper-blue-theme.el: * etc/themes/dichromacy-theme.el: * etc/themes/leuven-theme.el: * etc/themes/light-blue-theme.el: * etc/themes/manoj-dark-theme.el: * etc/themes/misterioso-theme.el: * etc/themes/tango-dark-theme.el: * etc/themes/tango-theme.el: * etc/themes/tsdh-dark-theme.el: * etc/themes/tsdh-light-theme.el: * etc/themes/wheatgrass-theme.el: * etc/themes/wombat-theme.el: Remove the now-redundant ':extend' attribute in all the themes.
-rw-r--r--doc/lispref/display.texi9
-rw-r--r--etc/NEWS25
-rw-r--r--etc/themes/adwaita-theme.el6
-rw-r--r--etc/themes/deeper-blue-theme.el14
-rw-r--r--etc/themes/dichromacy-theme.el4
-rw-r--r--etc/themes/leuven-theme.el24
-rw-r--r--etc/themes/light-blue-theme.el4
-rw-r--r--etc/themes/manoj-dark-theme.el20
-rw-r--r--etc/themes/misterioso-theme.el2
-rw-r--r--etc/themes/tango-dark-theme.el16
-rw-r--r--etc/themes/tango-theme.el8
-rw-r--r--etc/themes/tsdh-dark-theme.el10
-rw-r--r--etc/themes/tsdh-light-theme.el6
-rw-r--r--etc/themes/wheatgrass-theme.el4
-rw-r--r--etc/themes/wombat-theme.el4
-rw-r--r--lisp/faces.el19
-rw-r--r--test/data/themes/faces-test-dark-theme.el33
-rw-r--r--test/data/themes/faces-test-light-theme.el32
-rw-r--r--test/lisp/faces-tests.el29
19 files changed, 175 insertions, 94 deletions
diff --git a/doc/lispref/display.texi b/doc/lispref/display.texi
index ea3fa6f9b11..48a41f53677 100644
--- a/doc/lispref/display.texi
+++ b/doc/lispref/display.texi
@@ -2499,9 +2499,12 @@ space between end of line and edge of the window using this face, or
@code{nil} to not use this face for the space between the end of the
line and the edge of the window. When Emacs merges several faces for
displaying the empty space beyond end of line, only those faces with
-@code{:extend} non-@code{nil} will be merged. By default, only
-@code{region} and @code{hl-line} faces have this attribute set to
-@code{t}.
+@code{:extend} non-@code{nil} will be merged. By default, only a
+small number of faces, notably, @code{region}, have this attribute
+set. This attribute is different from the others in that when a theme
+doesn't specify an explicit value for a face, the value from the
+original face definition by @code{defface} is inherited
+(@pxref{Defining Faces}).
@end table
diff --git a/etc/NEWS b/etc/NEWS
index ade9fca7908..16b5176c24b 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -437,19 +437,20 @@ to 'completion-styles' or 'completion-category-overrides' to use it.
** The 'completion-common-part' face is now visible by default.
+++
-** New face attribute ':extend' to control face extension at EOL.
-The new face attribute ':extend' controls whether to use the face for
+** New face attribute ':extend' to control face extension at EOL. The
+new face attribute ':extend' controls whether to use the face for
displaying the empty space beyond end of line (EOL) till the edge of
-the window. By default, this attribute is non-nil only for 'region',
-'secondary-selection', 'hl-line' and some faces of Diff and Ediff
-modes; any other face that crosses end of line will not affect the
-display of the empty space at EOL. This is to make Emacs behave more
-like other GUI applications with respect to displaying faces that
-cross line boundaries.
-
-Themes that redefine faces should add a non-nil ':extend' attribute to
-the above-mentioned faces, to keep the behavior of the default face
-definitions.
+the window. By default, this attribute is non-nil only for a small
+number of faces, notably, 'region'; any other face that crosses end of
+line will not affect the display of the empty space at EOL. This is
+to make Emacs behave more like other GUI applications with respect to
+displaying faces that cross line boundaries.
+
+This attribute behaves specially when theme definitions are applied:
+if the theme doesn't specify an explicit value for a face, the value
+from the original face definition is inherited. Consequently, a theme
+generally shouldn't specify this attribute unless it has a good reason
+to do so.
** Connection-local variables
diff --git a/etc/themes/adwaita-theme.el b/etc/themes/adwaita-theme.el
index 3f29b9f061f..73ef7b6e9ee 100644
--- a/etc/themes/adwaita-theme.el
+++ b/etc/themes/adwaita-theme.el
@@ -39,7 +39,7 @@ default look of the Gnome 3 desktop.")
`(header-line ((,class (:foreground "#CCCCCC" :background "black"))))
`(minibuffer-prompt ((,class (:foreground "#0084C8" :bold t))))
- `(region ((,class (:foreground unspecified :background "#C2D5E9" :extend t))))
+ `(region ((,class (:foreground unspecified :background "#C2D5E9"))))
`(dired-header ((,class (:bold t :foreground "#0084C8"))))
`(widget-button ((,class (:bold t :foreground "#0084C8"))))
@@ -96,7 +96,7 @@ default look of the Gnome 3 desktop.")
`(gnus-cite-1 ((,class (:foreground "#00578E"))))
`(gnus-cite-2 ((,class (:foreground "#0084C8"))))
- `(diff-added ((,class (:bold t :foreground "#4E9A06" :extend t))))
- `(diff-removed ((,class (:bold t :foreground "#F5666D" :extend t))))))
+ `(diff-added ((,class (:bold t :foreground "#4E9A06"))))
+ `(diff-removed ((,class (:bold t :foreground "#F5666D"))))))
;;; adwaita-theme.el ends here
diff --git a/etc/themes/deeper-blue-theme.el b/etc/themes/deeper-blue-theme.el
index d50a641930a..d04a270ba5e 100644
--- a/etc/themes/deeper-blue-theme.el
+++ b/etc/themes/deeper-blue-theme.el
@@ -43,9 +43,9 @@
;; `(diff-added ((,class (nil))))
;; `(diff-changed ((,class (nil))))
`(diff-context ((,class (:foreground "seashell4"))))
- `(diff-file-header ((,class (:background "grey60" :extend t))))
+ `(diff-file-header ((,class (:background "grey60"))))
`(diff-function ((,class (:inherit diff-header))))
- `(diff-header ((,class (:background "grey45" :extend t))))
+ `(diff-header ((,class (:background "grey45"))))
`(diff-hunk-header ((,class (:inherit diff-header))))
`(diff-index ((,class (:inherit diff-file-header))))
`(diff-indicator-added ((,class (:foreground "white" :background "darkolivegreen"))))
@@ -54,12 +54,12 @@
`(diff-refine-change ((,class (:background "skyblue4"))))
;; `(diff-removed ((,class (nil))))
`(dired-marked ((,class (:background "dodgerblue3" :foreground "white"))))
- `(ediff-current-diff-A ((,class (:background "green4" :foreground "white" :extend t))))
- `(ediff-current-diff-B ((,class (:background "darkorange3" :foreground "white" :extend t))))
- `(ediff-even-diff-B ((,class (:background "Grey50" :foreground "White" :extend t))))
+ `(ediff-current-diff-A ((,class (:background "green4" :foreground "white"))))
+ `(ediff-current-diff-B ((,class (:background "darkorange3" :foreground "white"))))
+ `(ediff-even-diff-B ((,class (:background "Grey50" :foreground "White"))))
`(ediff-fine-diff-A ((,class (:background "skyblue4" :foreground "white"))))
`(ediff-fine-diff-B ((,class (:background "cyan4" :foreground "white"))))
- `(ediff-odd-diff-A ((,class (:background "Grey50" :foreground "White" :extend t))))
+ `(ediff-odd-diff-A ((,class (:background "Grey50" :foreground "White"))))
`(error ((,class (:foreground "red"))))
`(flymake-errline ((,class (:background nil :underline "red"))))
`(flymake-warnline ((,class (:background nil :underline "magenta3"))))
@@ -102,7 +102,7 @@
`(outline-4 ((,class (:foreground "turquoise2"))))
`(outline-5 ((,class (:foreground "aquamarine1"))))
`(primary-selection ((,class (:background "blue3"))))
- `(region ((,class (:background "#103050" :extend t))))
+ `(region ((,class (:background "#103050"))))
`(show-paren-match-face ((,class (:background "dodgerblue1" :foreground "white"))))
`(show-paren-mismatch-face ((,class (:background "red1" :foreground "white"))))
`(success ((,class (:foreground "SeaGreen2"))))
diff --git a/etc/themes/dichromacy-theme.el b/etc/themes/dichromacy-theme.el
index d585752ea4c..b361fe5c509 100644
--- a/etc/themes/dichromacy-theme.el
+++ b/etc/themes/dichromacy-theme.el
@@ -46,8 +46,8 @@ Ansi-Color faces are included.")
;; Highlighting faces
`(fringe ((,class (:background "#f7f7f7"))))
`(highlight ((,class (:foreground ,blue :background "#e5e5e5"))))
- `(region ((,class (:foreground unspecified :background ,yellow :extend t))))
- `(secondary-selection ((,class (:background "#e5e5e5" :extend t))))
+ `(region ((,class (:foreground unspecified :background ,yellow))))
+ `(secondary-selection ((,class (:background "#e5e5e5"))))
`(isearch ((,class (:foreground "white" :background ,vermillion))))
`(lazy-highlight ((,class (:foreground "white" :background ,redpurple))))
`(trailing-whitespace ((,class (:background ,vermillion))))
diff --git a/etc/themes/leuven-theme.el b/etc/themes/leuven-theme.el
index 677d91c5b74..d544f28da79 100644
--- a/etc/themes/leuven-theme.el
+++ b/etc/themes/leuven-theme.el
@@ -48,12 +48,12 @@ Semantic, and Ansi-Color faces are included -- and much more...")
(code-block '(:foreground "#000088" :background "#FFFFE0"))
(code-inline '(:foreground "#006400" :background "#FDFFF7"))
(column '(:height 1.0 :weight normal :slant normal :underline nil :strike-through nil :foreground "#E6AD4F" :background "#FFF2DE"))
- (diff-added '(:foreground "#008000" :background "#DDFFDD" :extend t))
+ (diff-added '(:foreground "#008000" :background "#DDFFDD"))
(diff-changed '(:foreground "#0000FF" :background "#DDDDFF"))
- (diff-header '(:foreground "#800000" :background "#FFFFAF" :extend t))
+ (diff-header '(:foreground "#800000" :background "#FFFFAF"))
(diff-hunk-header '(:foreground "#990099" :background "#FFEEFF"))
(diff-none '(:foreground "gray33"))
- (diff-removed '(:foreground "#A60000" :background "#FFDDDD" :extend t))
+ (diff-removed '(:foreground "#A60000" :background "#FFDDDD"))
(directory '(:weight bold :foreground "blue" :background "#FFFFD2"))
(highlight-line '(:background "#FFFFD7")) ; #F5F5F5
(highlight-line-gnus '(:background "#DAEAFC")) ; defined in `gnus-leuven.el'
@@ -76,7 +76,7 @@ Semantic, and Ansi-Color faces are included -- and much more...")
(ol8 '(:height 1.0 :weight bold :slant italic :foreground "#FD8008"))
(paren-matched '(:background "#99CCFF"))
(paren-unmatched '(:underline "red" :foreground nil :background "#FFDCDC"))
- (region '(:background "#ABDFFA" :extend t))
+ (region '(:background "#ABDFFA"))
(shadow '(:foreground "#7F7F7F"))
(string '(:foreground "#008000")) ; or #D0372D
(subject '(:family "Sans Serif" :weight bold :foreground "black"))
@@ -243,15 +243,15 @@ Semantic, and Ansi-Color faces are included -- and much more...")
`(smerge-refined-change ((,class (:background "#AAAAFF"))))
;; Ediff
- `(ediff-current-diff-A ((,class (:foreground "gray33" :background "#FFDDDD" :extend t))))
- `(ediff-current-diff-B ((,class (:foreground "gray33" :background "#DDFFDD" :extend t))))
- `(ediff-current-diff-C ((,class (:foreground "black" :background "cyan" :extend t))))
- `(ediff-even-diff-A ((,class (:foreground "black" :background "light grey" :extend t))))
- `(ediff-even-diff-B ((,class (:foreground "black" :background "light grey" :extend t))))
+ `(ediff-current-diff-A ((,class (:foreground "gray33" :background "#FFDDDD"))))
+ `(ediff-current-diff-B ((,class (:foreground "gray33" :background "#DDFFDD"))))
+ `(ediff-current-diff-C ((,class (:foreground "black" :background "cyan"))))
+ `(ediff-even-diff-A ((,class (:foreground "black" :background "light grey"))))
+ `(ediff-even-diff-B ((,class (:foreground "black" :background "light grey"))))
`(ediff-fine-diff-A ((,class (:foreground "#A60000" :background "#FFAAAA"))))
`(ediff-fine-diff-B ((,class (:foreground "#008000" :background "#55FF55"))))
- `(ediff-odd-diff-A ((,class (:foreground "black" :background "light grey" :extend t))))
- `(ediff-odd-diff-B ((,class (:foreground "black" :background "light grey" :extend t))))
+ `(ediff-odd-diff-A ((,class (:foreground "black" :background "light grey"))))
+ `(ediff-odd-diff-B ((,class (:foreground "black" :background "light grey"))))
;; Flyspell
;; (when (version< emacs-version "24.XXX")
@@ -462,7 +462,7 @@ Semantic, and Ansi-Color faces are included -- and much more...")
`(info-xref-visited ((,class (:underline t :foreground "magenta4")))) ; previously visited cross-references
`(light-symbol-face ((,class (:background "#FFFFA0"))))
`(linum ((,class (:inherit (default shadow) :foreground "#9A9A9A" :background "#EDEDED"))))
- `(log-view-file ((,class (:foreground "#0000CC" :background "#EAF2F5" :extend t))))
+ `(log-view-file ((,class (:foreground "#0000CC" :background "#EAF2F5"))))
`(lui-button-face ((,class ,link)))
`(lui-highlight-face ((,class (:box '(:line-width 1 :color "#CC0000") :foreground "#CC0000" :background "#FFFF88")))) ; my nickname
`(lui-time-stamp-face ((,class (:foreground "purple"))))
diff --git a/etc/themes/light-blue-theme.el b/etc/themes/light-blue-theme.el
index e6d4a3a4b57..3060dcf09c7 100644
--- a/etc/themes/light-blue-theme.el
+++ b/etc/themes/light-blue-theme.el
@@ -36,8 +36,8 @@
`(fringe ((,class (:background "gray85"))))
;; Highlighting faces
`(highlight ((,class (:background "cyan"))))
- `(region ((,class (:background "MediumAquamarine" :extend t))))
- `(secondary-selection ((,class (:background "white" :foreground "black" :extend t))))
+ `(region ((,class (:background "MediumAquamarine"))))
+ `(secondary-selection ((,class (:background "white" :foreground "black"))))
`(isearch ((,class (:background "green" :foreground "Black"))))
`(lazy-highlight ((,class (:background "dark turquoise"))))
`(query-replace ((,class (:inherit isearch :background "white" :foreground "black"))))
diff --git a/etc/themes/manoj-dark-theme.el b/etc/themes/manoj-dark-theme.el
index 1313caa3c6e..20e04cb7543 100644
--- a/etc/themes/manoj-dark-theme.el
+++ b/etc/themes/manoj-dark-theme.el
@@ -435,11 +435,11 @@ jarring angry fruit salad look to reduce eye fatigue.")
'(diary-button ((t (:background "lightgrey" :foreground "black" :box (:line-width 2 :style released-button)))))
'(diary-face ((t (:foreground "IndianRed"))))
'(diary-time ((t (:foreground "LightGoldenrod"))))
- '(diff-added ((t (:foreground "Green" :extend t))))
+ '(diff-added ((t (:foreground "Green"))))
'(diff-added-face ((t (:foreground "Green"))))
'(diff-changed-face ((t (:foreground "Khaki"))))
'(diff-context-face ((t (:foreground "grey70"))))
- '(diff-file-header ((t (:bold t :background "grey20" :foreground "ivory1" :weight bold :extend t))))
+ '(diff-file-header ((t (:bold t :background "grey20" :foreground "ivory1" :weight bold))))
'(diff-file-header-face ((t (:bold t :background "grey20" :foreground "ivory1" :weight bold))))
'(diff-function-face ((t (:foreground "SpringGreen1"))))
'(diff-header-face ((t (:background "SlateBlue4"))))
@@ -448,7 +448,7 @@ jarring angry fruit salad look to reduce eye fatigue.")
'(diff-index-face ((t (:bold t :weight bold :background "SteelBlue4" :foreground "linen" ))))
'(diff-nonexistent ((t (:bold t :weight bold :background "Black" :foreground "Wheat1"))))
'(diff-nonexistent-face ((t (:bold t :weight bold :background "Black" :foreground "Wheat1"))))
- '(diff-removed ((t (:foreground "salmon1" :extend t))))
+ '(diff-removed ((t (:foreground "salmon1"))))
'(diff-removed-face ((t (:foreground "salmon1"))))
'(diff-refine-change-face ((t (:background "MidnightBlue"))))
'(diff-refine-change ((t (:background "MidnightBlue"))))
@@ -511,7 +511,7 @@ jarring angry fruit salad look to reduce eye fatigue.")
'(header-line ((t (:box (:line-width -1 :color "grey20" :style released-button) :background "grey20" :foreground "grey90" :height 0.9))))
'(help-argument-name ((t (:italic t :slant italic))))
'(highlight ((t (:background "gray10" :foreground "Old Lace"))))
- '(hl-line ((t (:background "grey10" :foreground "Old Lace" :extend t))))
+ '(hl-line ((t (:background "grey10" :foreground "Old Lace"))))
'(gnus-mouse-face ((t (:background "darkseagreen2" :foreground "blue"))))
'(erc-button-mouse-face ((t (:background "darkseagreen2" :foreground "blue"))))
'(align-highlight-change-face ((t (:background "darkseagreen2" :foreground "blue"))))
@@ -601,7 +601,7 @@ jarring angry fruit salad look to reduce eye fatigue.")
'(paren-mismatch-face ((t (:bold t :background "white" :foreground "red"))))
'(paren-no-match-face ((t (:bold t :background "white" :foreground "red"))))
'(query-replace ((t (:foreground "brown4" :background "palevioletred2"))))
- '(region ((t (:background "blue3" :extend t))))
+ '(region ((t (:background "blue3"))))
'(realgud-overlay-arrow1 ((t (:foreground "medium sea green"))))
'(realgud-overlay-arrow2 ((t (:foreground "white"))))
'(realgud-overlay-arrow3 ((t (:foreground "indian red"))))
@@ -613,7 +613,7 @@ jarring angry fruit salad look to reduce eye fatigue.")
'(realgud-line-number ((t (:foreground "yellow"))))
'(realgud-backtrace-number ((t (:foreground "yellow" :weight bold))))
'(scroll-bar ((t (:background "grey75" :foreground "WhiteSmoke"))))
- '(secondary-selection ((t (:background "SkyBlue4" :extend t))))
+ '(secondary-selection ((t (:background "SkyBlue4"))))
'(semantic-dirty-token-face ((t (:background "lightyellow"))))
'(semantic-highlight-edits-face ((t (:background "gray20"))))
'(semantic-unmatched-syntax-face ((t (:underline "red"))))
@@ -631,10 +631,10 @@ jarring angry fruit salad look to reduce eye fatigue.")
'(show-paren-match ((t (:background "steelblue3"))))
'(show-paren-match-face ((t (:background "steelblue3"))))
'(show-paren-mismatch ((t (:background "purple" :foreground "white"))))
- '(smerge-base ((t (:foreground "orange" :extend t))))
- '(smerge-markers ((t (:background "grey30" :extend t))))
- '(smerge-mine ((t (:foreground "cyan" :extend t))))
- '(smerge-other ((t (:foreground "lightgreen" :extend t))))
+ '(smerge-base ((t (:foreground "orange"))))
+ '(smerge-markers ((t (:background "grey30"))))
+ '(smerge-mine ((t (:foreground "cyan"))))
+ '(smerge-other ((t (:foreground "lightgreen"))))
'(smerge-refined-change ((t (:background "blue4"))))
'(speedbar-button-face ((t (:foreground "green3"))))
'(speedbar-directory-face ((t (:foreground "light blue"))))
diff --git a/etc/themes/misterioso-theme.el b/etc/themes/misterioso-theme.el
index c7e1dc983fb..727270c27f5 100644
--- a/etc/themes/misterioso-theme.el
+++ b/etc/themes/misterioso-theme.el
@@ -37,7 +37,7 @@
;; Highlighting faces
`(fringe ((,class (:background "#2e3748"))))
`(highlight ((,class (:background "#338f86" :foreground "#e1e1e0"))))
- `(region ((,class (:background "#2d4948" :foreground "#e1e1e0" :extend t))))
+ `(region ((,class (:background "#2d4948" :foreground "#e1e1e0"))))
`(isearch ((,class (:background "#fcffad" :foreground "#000000"))))
`(lazy-highlight ((,class (:background "#338f86"))))
`(trailing-whitespace ((,class (:background "#ff4242"))))
diff --git a/etc/themes/tango-dark-theme.el b/etc/themes/tango-dark-theme.el
index d2fdff8e091..91256208a3f 100644
--- a/etc/themes/tango-dark-theme.el
+++ b/etc/themes/tango-dark-theme.el
@@ -61,8 +61,8 @@ Semantic, and Ansi-Color faces are included.")
;; Highlighting faces
`(fringe ((,class (:background ,alum-7))))
`(highlight ((,class (:foreground ,alum-6 :background "#c0c000"))))
- `(region ((,class (:background ,alum-5 :extend t))))
- `(secondary-selection ((,class (:background ,blue-3 :extend t))))
+ `(region ((,class (:background ,alum-5))))
+ `(secondary-selection ((,class (:background ,blue-3))))
`(isearch ((,class (:foreground ,alum-1 :background ,orange-3))))
`(lazy-highlight ((,class (:background ,choc-3))))
`(trailing-whitespace ((,class (:background ,red-3))))
@@ -130,14 +130,14 @@ Semantic, and Ansi-Color faces are included.")
;; SMerge faces
`(smerge-refined-change ((,class (:background ,blue-3))))
;; Ediff faces
- `(ediff-current-diff-A ((,class (:background ,alum-5 :extend t))))
+ `(ediff-current-diff-A ((,class (:background ,alum-5))))
`(ediff-fine-diff-A ((,class (:background ,blue-3))))
- `(ediff-even-diff-A ((,class (:background ,alum-5.5 :extend t))))
- `(ediff-odd-diff-A ((,class (:background ,alum-5.5 :extend t))))
- `(ediff-current-diff-B ((,class (:background ,alum-5 :extend t))))
+ `(ediff-even-diff-A ((,class (:background ,alum-5.5))))
+ `(ediff-odd-diff-A ((,class (:background ,alum-5.5))))
+ `(ediff-current-diff-B ((,class (:background ,alum-5))))
`(ediff-fine-diff-B ((,class (:background ,choc-3))))
- `(ediff-even-diff-B ((,class (:background ,alum-5.5 :extend t))))
- `(ediff-odd-diff-B ((,class (:background ,alum-5.5 :extend t))))
+ `(ediff-even-diff-B ((,class (:background ,alum-5.5))))
+ `(ediff-odd-diff-B ((,class (:background ,alum-5.5))))
;; Flyspell faces
`(flyspell-duplicate ((,class (:underline ,orange-1))))
`(flyspell-incorrect ((,class (:underline ,red-1))))
diff --git a/etc/themes/tango-theme.el b/etc/themes/tango-theme.el
index c832192968a..12d4db3fe7c 100644
--- a/etc/themes/tango-theme.el
+++ b/etc/themes/tango-theme.el
@@ -53,8 +53,8 @@ Semantic, and Ansi-Color faces are included.")
;; Highlighting faces
`(fringe ((,class (:background ,alum-2))))
`(highlight ((,class (:background ,alum-3))))
- `(region ((,class (:background ,alum-3 :extend t))))
- `(secondary-selection ((,class (:background ,blue-0 :extend t))))
+ `(region ((,class (:background ,alum-3))))
+ `(secondary-selection ((,class (:background ,blue-0))))
`(isearch ((,class (:foreground "#ffffff" :background ,orange-3))))
`(lazy-highlight ((,class (:background ,choc-1))))
`(trailing-whitespace ((,class (:background ,red-1))))
@@ -117,9 +117,9 @@ Semantic, and Ansi-Color faces are included.")
;; SMerge
`(smerge-refined-change ((,class (:background ,plum-1))))
;; Ediff
- `(ediff-current-diff-A ((,class (:background ,blue-1 :extend t))))
+ `(ediff-current-diff-A ((,class (:background ,blue-1))))
`(ediff-fine-diff-A ((,class (:background ,plum-1))))
- `(ediff-current-diff-B ((,class (:background ,butter-1 :extend t))))
+ `(ediff-current-diff-B ((,class (:background ,butter-1))))
`(ediff-fine-diff-B ((,class (:background ,orange-1))))
;; Flyspell
`(flyspell-duplicate ((,class (:underline ,orange-1))))
diff --git a/etc/themes/tsdh-dark-theme.el b/etc/themes/tsdh-dark-theme.el
index bd0564a21dc..5482ced6b29 100644
--- a/etc/themes/tsdh-dark-theme.el
+++ b/etc/themes/tsdh-dark-theme.el
@@ -26,12 +26,12 @@
'tsdh-dark
'(aw-leading-char-face ((t (:background "gray30" :foreground "red" :weight bold))))
'(default ((t (:background "gray20" :foreground "white smoke"))))
- '(diff-added ((t (:inherit diff-changed :background "dark green" :extend t))) t)
+ '(diff-added ((t (:inherit diff-changed :background "dark green"))) t)
'(diff-changed ((t (:background "midnight blue"))) t)
'(diff-indicator-added ((t (:inherit diff-indicator-changed))) t)
'(diff-indicator-changed ((t (:weight bold))) t)
'(diff-indicator-removed ((t (:inherit diff-indicator-changed))) t)
- '(diff-removed ((t (:inherit diff-changed :background "dark red" :extend t))) t)
+ '(diff-removed ((t (:inherit diff-changed :background "dark red"))) t)
'(dired-directory ((t (:foreground "DodgerBlue" :weight bold))))
'(error ((t (:foreground "deep pink" :weight bold))))
'(eshell-prompt ((t (:inherit font-lock-function-name-face :weight bold))))
@@ -69,7 +69,7 @@
'(header-line ((t (:inverse-video t :box (:line-width -1 :color "red" :style released-button)))))
'(helm-header ((t (:background "DeepSkyBlue4" :weight bold))))
'(highlight ((t (:background "sea green"))))
- '(hl-line ((t (:background "grey25" :extend t))))
+ '(hl-line ((t (:background "grey25"))))
'(hl-paren-face ((t (:weight bold))) t)
'(icomplete-first-match ((t (:foreground "deep sky blue" :weight bold))))
'(ido-first-match ((t (:foreground "turquoise" :weight bold))))
@@ -132,9 +132,9 @@
'(rcirc-other-nick ((t (:foreground "dodger blue"))) t)
'(rcirc-track-keyword ((t (:foreground "DodgerBlue" :weight bold))) t)
'(rcirc-track-nick ((t (:background "yellow" :foreground "DodgerBlue" :weight bold))) t)
- '(region ((t (:background "SeaGreen4" :extend t))))
+ '(region ((t (:background "SeaGreen4"))))
'(scroll-bar ((t (:background "gray20" :foreground "dark turquoise"))))
- '(secondary-selection ((t (:background "#333366" :foreground "#f6f3e8" :extend t))))
+ '(secondary-selection ((t (:background "#333366" :foreground "#f6f3e8"))))
'(show-paren-match ((t (:background "DeepSkyBlue4"))))
'(show-paren-mismatch ((t (:background "dark magenta"))))
'(swiper-match-face-1 ((t (:background "gray35"))))
diff --git a/etc/themes/tsdh-light-theme.el b/etc/themes/tsdh-light-theme.el
index efc49c1a216..8e6a79f8e36 100644
--- a/etc/themes/tsdh-light-theme.el
+++ b/etc/themes/tsdh-light-theme.el
@@ -29,12 +29,12 @@ Used and created by Tassilo Horn.")
'(Info-quoted ((t (:underline "gray40" :weight bold))))
'(aw-leading-char-face ((t (:background "red" :foreground "white" :weight bold))))
'(default ((t (:background "white" :foreground "black"))))
- '(diff-added ((t (:inherit diff-changed :background "light green" :extend t))))
+ '(diff-added ((t (:inherit diff-changed :background "light green"))))
'(diff-changed ((t (:background "light steel blue"))))
'(diff-indicator-added ((t (:inherit diff-indicator-changed))))
'(diff-indicator-changed ((t (:weight bold))))
'(diff-indicator-removed ((t (:inherit diff-indicator-changed))))
- '(diff-removed ((t (:inherit diff-changed :background "sandy brown" :extend t))))
+ '(diff-removed ((t (:inherit diff-changed :background "sandy brown"))))
'(dired-directory ((t (:inherit font-lock-function-name-face :weight bold))))
'(font-lock-builtin-face ((t (:foreground "#e44649"))))
'(font-lock-comment-delimiter-face ((t (:inherit font-lock-comment-face :weight bold))))
@@ -62,7 +62,7 @@ Used and created by Tassilo Horn.")
'(gnus-group-news-2-empty ((t (:foreground "tomato3"))))
'(gnus-group-news-3 ((t (:inherit gnus-group-news-3-empty :weight bold))))
'(gnus-group-news-3-empty ((t (:foreground "tomato2")))) '(header-line ((t (:inherit mode-line :inverse-video t))))
- '(hl-line ((t (:background "#f0f0f1" :extend t))))
+ '(hl-line ((t (:background "#f0f0f1"))))
'(hl-paren-face ((t (:weight bold))) t)
'(minibuffer-prompt ((t (:foreground "#0184bc" :box (:line-width -1 :style released-button) :weight bold))))
'(mode-line ((t (:background "#f0f0f1" :box (:line-width 1 :color "#383a42")))))
diff --git a/etc/themes/wheatgrass-theme.el b/etc/themes/wheatgrass-theme.el
index 2628b68ff06..640343a33bc 100644
--- a/etc/themes/wheatgrass-theme.el
+++ b/etc/themes/wheatgrass-theme.el
@@ -40,8 +40,8 @@ of green, brown, and blue.")
`(compilation-info ((,class (:foreground "ForestGreen"))))
;; Highlighting faces
`(highlight ((,class (:foreground "white" :background "dark green"))))
- `(region ((,class (:foreground "white" :background "dark green" :extend t))))
- `(secondary-selection ((,class (:background "dark slate gray" :extend t))))
+ `(region ((,class (:foreground "white" :background "dark green"))))
+ `(secondary-selection ((,class (:background "dark slate gray"))))
`(isearch ((,class (:foreground "white" :background "dark goldenrod"))))
`(lazy-highlight ((,class (:background "gray25"))))
;; Font lock faces
diff --git a/etc/themes/wombat-theme.el b/etc/themes/wombat-theme.el
index 0a5e87ac585..c56700ffd9a 100644
--- a/etc/themes/wombat-theme.el
+++ b/etc/themes/wombat-theme.el
@@ -36,8 +36,8 @@ are included.")
`(fringe ((,class (:background "#303030"))))
`(highlight ((,class (:background "#454545" :foreground "#ffffff"
:underline t))))
- `(region ((,class (:background "#444444" :foreground "#f6f3e8" :extend t))))
- `(secondary-selection ((,class (:background "#333366" :foreground "#f6f3e8" :extend t))))
+ `(region ((,class (:background "#444444" :foreground "#f6f3e8"))))
+ `(secondary-selection ((,class (:background "#333366" :foreground "#f6f3e8"))))
`(isearch ((,class (:background "#343434" :foreground "#857b6f"))))
`(lazy-highlight ((,class (:background "#384048" :foreground "#a0a8b0"))))
;; Mode line faces
diff --git a/lisp/faces.el b/lisp/faces.el
index dc5bcca7609..0f31628f5f9 100644
--- a/lisp/faces.el
+++ b/lisp/faces.el
@@ -1669,7 +1669,7 @@ The following sources are applied in this order:
;; `theme-face' records.
(let ((theme-faces (get face 'theme-face))
(no-match-found 0)
- face-attrs theme-face-applied)
+ default-attrs face-attrs theme-face-applied)
(if theme-faces
(dolist (elt (reverse theme-faces))
(setq face-attrs (face-spec-choose (cadr elt) frame no-match-found))
@@ -1677,13 +1677,20 @@ The following sources are applied in this order:
(face-spec-set-2 face frame face-attrs)
(setq theme-face-applied t))))
;; If there was a spec applicable to FRAME, that overrides the
- ;; defface spec entirely (rather than inheriting from it). If
- ;; there was no spec applicable to FRAME, apply the defface spec
- ;; as well as any applicable X resources.
+ ;; defface spec entirely rather than inheriting from it, with the
+ ;; exception of the :extend attribute (which is inherited).
+ ;;
+ ;; If there was no spec applicable to FRAME, apply the defface
+ ;; spec as well as any applicable X resources.
+ (setq default-attrs (face-spec-choose (face-default-spec face) frame))
(unless theme-face-applied
- (setq face-attrs (face-spec-choose (face-default-spec face) frame))
- (face-spec-set-2 face frame face-attrs)
+ (face-spec-set-2 face frame default-attrs)
(make-face-x-resource-internal face frame))
+ (when (and theme-face-applied
+ (eq 'unspecified (face-attribute face :extend frame t)))
+ (let ((tail (plist-member default-attrs :extend)))
+ (and tail (face-spec-set-2 face frame
+ (list :extend (cadr tail))))))
(setq face-attrs (face-spec-choose (get face 'face-override-spec) frame))
(face-spec-set-2 face frame face-attrs)))
diff --git a/test/data/themes/faces-test-dark-theme.el b/test/data/themes/faces-test-dark-theme.el
new file mode 100644
index 00000000000..2c114069f9c
--- /dev/null
+++ b/test/data/themes/faces-test-dark-theme.el
@@ -0,0 +1,33 @@
+;;; faces-test-dark-theme.el --- A dark theme from tests ;;; -*- lexical-binding: t; -*-
+
+;; Copyright (C) 2019 Free Software Foundation, Inc.
+
+;; This program is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+
+;; This program is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with this program. If not, see <https://www.gnu.org/licenses/>.
+
+;;; Commentary:
+
+;;; Code:
+
+(deftheme faces-test-dark
+ "")
+
+(custom-theme-set-faces
+ 'faces-test-dark
+ '(diff-added ((t (:foreground "Green" :extend t))))
+ '(diff-changed-face ((t (:foreground "Khaki"))))
+ '(diff-file-header-face ((t (:background "grey20" :foreground "ivory1")))))
+
+(provide-theme 'faces-test-dark)
+
+;;; faces-test-dark-theme.el ends here
diff --git a/test/data/themes/faces-test-light-theme.el b/test/data/themes/faces-test-light-theme.el
new file mode 100644
index 00000000000..fc22d47cf8d
--- /dev/null
+++ b/test/data/themes/faces-test-light-theme.el
@@ -0,0 +1,32 @@
+;;; faces-test-light-theme.el --- A dark theme from tests ;;; -*- lexical-binding: t; -*-
+
+;; Copyright (C) 2019 Free Software Foundation, Inc.
+
+;; This program is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+
+;; This program is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with this program. If not, see <https://www.gnu.org/licenses/>.
+
+;;; Commentary:
+
+;;; Code:
+
+(deftheme faces-test-light
+ "")
+
+(custom-theme-set-faces
+ 'faces-test-light
+ '(diff-added ((t (:inherit diff-changed :background "light green" :extend t))))
+ '(diff-changed ((t (:background "light steel blue")))))
+
+(provide-theme 'faces-test-light)
+
+;;; faces-test-light-theme.el ends here
diff --git a/test/lisp/faces-tests.el b/test/lisp/faces-tests.el
index 7cba4b26ebe..eb8c533b8e6 100644
--- a/test/lisp/faces-tests.el
+++ b/test/lisp/faces-tests.el
@@ -23,6 +23,11 @@
(require 'ert)
(require 'faces)
+(defvar faces--test-data-dir
+ (expand-file-name "../data/"
+ (file-name-directory (or load-file-name
+ buffer-file-name))))
+
(defgroup faces--test nil ""
:group 'faces--test)
@@ -117,8 +122,9 @@
(should (equal (face-attribute 'diff-changed-face :extend) t))
(should (equal (face-attribute 'diff-added :extend) 'unspecified))
(should (equal (face-attribute 'diff-file-header-face :extend) nil))
- (load-theme 'manoj-dark t t)
- (load-theme 'tsdh-light t t)
+ (add-to-list 'custom-theme-load-path (concat faces--test-data-dir "themes"))
+ (load-theme 'faces-test-dark t t)
+ (load-theme 'faces-test-light t t)
(should (equal (face-attribute 'faces--test-inherit-extend :extend)
'unspecified))
(should (equal (face-attribute 'faces--test-inherit-extend :extend nil t) t))
@@ -129,7 +135,7 @@
(should (equal (face-attribute 'diff-changed-face :extend) t))
(should (equal (face-attribute 'diff-added :extend) 'unspecified))
(should (equal (face-attribute 'diff-file-header-face :extend) nil))
- (enable-theme 'manoj-dark)
+ (enable-theme 'faces-test-dark)
(should (equal (face-attribute 'faces--test-inherit-extend :extend)
'unspecified))
(should (equal (face-attribute 'faces--test-inherit-extend :extend nil t) t))
@@ -137,14 +143,14 @@
'unspecified))
(should (equal (face-attribute 'faces--test-inherit-no-extend :extend nil t)
nil))
- (should (equal (face-attribute 'diff-changed-face :extend) 'unspecified)) ; should be t
+ (should (equal (face-attribute 'diff-changed-face :extend) t))
(should (equal (face-attribute 'diff-added :extend) t))
- (should (equal (face-attribute 'diff-file-header-face :extend) 'unspecified)) ; should be nil
+ (should (equal (face-attribute 'diff-file-header-face :extend) nil))
(defface faces--test-face3
'((t :inherit diff-added :weight bold))
"")
(should (equal (face-attribute 'faces--test-face3 :extend nil t) t))
- (disable-theme 'manoj-dark)
+ (disable-theme 'faces-test-dark)
(should (equal (face-attribute 'faces--test-inherit-extend :extend)
'unspecified))
(should (equal (face-attribute 'faces--test-inherit-extend :extend nil t) t))
@@ -159,7 +165,7 @@
(defface diff-indicator-changed
'((t (:weight bold :extend t)))
"")
- (enable-theme 'tsdh-light)
+ (enable-theme 'faces-test-light)
(should (equal (face-attribute 'faces--test-inherit-extend :extend)
'unspecified))
(should (equal (face-attribute 'faces--test-inherit-extend :extend nil t) t))
@@ -170,7 +176,7 @@
(should (equal (face-attribute 'diff-changed-face :extend) t))
(should (equal (face-attribute 'diff-added :extend) t))
(should (equal (face-attribute 'diff-file-header-face :extend) nil))
- (should (equal (face-attribute 'diff-indicator-changed :extend) 'unspecified)) ; should be t
+ (should (equal (face-attribute 'diff-indicator-changed :extend) t))
(should (equal (face-attribute 'faces--test-face3 :extend nil t) t))
(frame-set-background-mode (selected-frame) 'dark)
(should (equal (face-attribute 'faces--test-inherit-extend :extend)
@@ -183,7 +189,7 @@
(should (equal (face-attribute 'diff-changed-face :extend) t))
(should (equal (face-attribute 'diff-added :extend) t))
(should (equal (face-attribute 'diff-file-header-face :extend) nil))
- (should (equal (face-attribute 'diff-indicator-changed :extend) 'unspecified)) ; should be t
+ (should (equal (face-attribute 'diff-indicator-changed :extend) t))
(should (equal (face-attribute 'faces--test-face3 :extend nil t) t))
(or noninteractive
(let ((fr (make-frame)))
@@ -200,11 +206,10 @@
(should (equal (face-attribute 'diff-changed-face :extend fr) t))
(should (equal (face-attribute 'diff-added :extend fr) t))
(should (equal (face-attribute 'diff-file-header-face :extend fr) nil))
- (should (equal (face-attribute 'diff-indicator-changed :extend fr)
- 'unspecified)) ; should be t
+ (should (equal (face-attribute 'diff-indicator-changed :extend fr) t))
(should (equal (face-attribute 'faces--test-face3 :extend nil t) t))
))
- (disable-theme 'tsdh-light)
+ (disable-theme 'faces-test-light)
(should (equal (face-attribute 'diff-indicator-changed :extend) t))
(should (equal (face-attribute 'faces--test-face3 :extend nil t) 'unspecified))
(or noninteractive