diff options
author | Chong Yidong <cyd@gnu.org> | 2013-12-22 21:40:44 +0800 |
---|---|---|
committer | Chong Yidong <cyd@gnu.org> | 2013-12-22 21:40:44 +0800 |
commit | dca38cf96056f20a1b03cf24ff93644b0e44ea4e (patch) | |
tree | 9db699f1505b918172ce447db02149479db4d585 /lisp/faces.el | |
parent | 647d367f3b5c92db371da218aa8e5f643b2ad1ad (diff) | |
download | emacs-dca38cf96056f20a1b03cf24ff93644b0e44ea4e.tar.gz |
Prevent themes from obliterating faces on low-color terminals.
* lisp/faces.el (face-spec-recalc): If the theme specs are not
applicable to a frame, fall back on the defface spec.
Diffstat (limited to 'lisp/faces.el')
-rw-r--r-- | lisp/faces.el | 26 |
1 files changed, 17 insertions, 9 deletions
diff --git a/lisp/faces.el b/lisp/faces.el index 13283665781..d60d1d287e0 100644 --- a/lisp/faces.el +++ b/lisp/faces.el @@ -1625,20 +1625,28 @@ then the override spec." (setq face (get face 'face-alias))) (face-spec-reset-face face frame) ;; If FACE is customized or themed, set the custom spec from - ;; `theme-face' records, which completely replace the defface spec - ;; rather than inheriting from it. - (let ((theme-faces (get face 'theme-face))) + ;; `theme-face' records. + (let ((theme-faces (get face 'theme-face)) + spec theme-face-applied) (if theme-faces - (dolist (spec (reverse theme-faces)) - (face-spec-set-2 face frame (cadr spec))) - (face-spec-set-2 face frame (face-default-spec face)))) - (face-spec-set-2 face frame (get face 'face-override-spec)) + (dolist (elt (reverse theme-faces)) + (setq spec (face-spec-choose (cadr elt) frame)) + (when spec + (face-spec-set-2 face frame spec) + (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. + (unless theme-face-applied + (setq spec (face-spec-choose (face-default-spec face) frame)) + (face-spec-set-2 face frame spec)) + (setq spec (face-spec-choose (get face 'face-override-spec) frame)) + (face-spec-set-2 face frame spec)) (make-face-x-resource-internal face frame)) (defun face-spec-set-2 (face frame spec) "Set the face attributes of FACE on FRAME according to SPEC." - (let* ((spec (face-spec-choose spec frame)) - attrs) + (let (attrs) (while spec (when (assq (car spec) face-x-resources) (push (car spec) attrs) |