emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] trunk r115691: Prevent themes from obliterating faces on l


From: Chong Yidong
Subject: [Emacs-diffs] trunk r115691: Prevent themes from obliterating faces on low-color terminals.
Date: Sun, 22 Dec 2013 13:40:50 +0000
User-agent: Bazaar (2.6b2)

------------------------------------------------------------
revno: 115691
revision-id: address@hidden
parent: address@hidden
committer: Chong Yidong <address@hidden>
branch nick: trunk
timestamp: Sun 2013-12-22 21:40:44 +0800
message:
  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.
modified:
  lisp/ChangeLog                 changelog-20091113204419-o5vbwnq5f7feedwu-1432
  lisp/faces.el                  faces.el-20091113204419-o5vbwnq5f7feedwu-562
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog    2013-12-22 06:04:40 +0000
+++ b/lisp/ChangeLog    2013-12-22 13:40:44 +0000
@@ -1,3 +1,9 @@
+2013-12-22  Chong Yidong  <address@hidden>
+
+       * faces.el (face-spec-recalc): If the theme specs are not
+       applicable to a frame, fall back on the defface spec.  This
+       prevents themes from obliterating faces on low-color terminals.
+
 2013-12-22  Dmitry Gutov  <address@hidden>
 
        * progmodes/ruby-mode.el (ruby-smie--implicit-semi-p): Return t

=== modified file 'lisp/faces.el'
--- a/lisp/faces.el     2013-12-21 15:31:09 +0000
+++ b/lisp/faces.el     2013-12-22 13:40:44 +0000
@@ -1625,20 +1625,28 @@
     (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)


reply via email to

[Prev in Thread] Current Thread [Next in Thread]