]> code.delx.au - gnu-emacs/commitdiff
Don't make faces when loading Custom themes.
authorChong Yidong <cyd@gnu.org>
Sat, 21 Dec 2013 15:31:09 +0000 (23:31 +0800)
committerChong Yidong <cyd@gnu.org>
Sat, 21 Dec 2013 15:31:09 +0000 (23:31 +0800)
* custom.el (custom-theme-recalc-face): Do nothing if the face is
undefined.  Thus, theme settings for undefined faces do not take
effect until the faces are defined with defface, the same as with
theme variables.

* faces.el (face-spec-set): Use face-spec-recalc in all cases.
(face-spec-reset-face): Don't assign extra properties in temacs.
(face-spec-recalc): Apply X resources too.

lisp/ChangeLog
lisp/custom.el
lisp/faces.el

index 0e452aa6686326ba5b4059628bc07d4826889d5e..c81dbf2889a85b8048baf0841ee2dda16b4c0c1a 100644 (file)
@@ -1,11 +1,20 @@
+2013-12-21  Chong Yidong  <cyd@gnu.org>
+
+       * custom.el (custom-theme-recalc-face): Do nothing if the face is
+       undefined.  Thus, theme settings for undefined faces do not take
+       effect until the faces are defined with defface, the same as with
+       theme variables.
+
+       * faces.el (face-spec-set): Use face-spec-recalc in all cases.
+       (face-spec-reset-face): Don't assign extra properties in temacs.
+       (face-spec-recalc): Apply X resources too.
+
 2013-12-21  Chong Yidong  <cyd@gnu.org>
 
        * faces.el (face-spec-set):
        * cus-face.el (custom-theme-set-faces, custom-set-faces):
        * custom.el (defface): Doc fixes (Bug#16203).
 
-2013-12-21  Chong Yidong  <cyd@gnu.org>
-
        * indent.el (indent-rigidly-map): Add docstring, and move commands
        into named functions.
        (indent-rigidly-left, indent-rigidly-right)
index 8b675c4a7430de5551fa237d2b050d65c8acf66e..58477a58ad32cb6114ad48253891e72aa2eeffca 100644 (file)
@@ -1459,12 +1459,15 @@ This function returns nil if no custom theme specifies a value for VARIABLE."
                 (eval (car valspec))))))
 
 (defun custom-theme-recalc-face (face)
-  "Set FACE according to currently enabled custom themes."
+  "Set FACE according to currently enabled custom themes.
+If FACE is not initialized as a face, do nothing; otherwise call
+`face-spec-recalc' to recalculate the face on all frames."
   (if (get face 'face-alias)
       (setq face (get face 'face-alias)))
-  ;; Reset the faces for each frame.
-  (dolist (frame (frame-list))
-    (face-spec-recalc face frame)))
+  (if (facep face)
+      ;; Reset the faces for each frame.
+      (dolist (frame (frame-list))
+       (face-spec-recalc face frame))))
 
 \f
 ;;; XEmacs compatibility functions
index 403cf8b1b9a927d83bef55a9bf393b7a455cb3ff..13283665781dcc9d402245ff3fc270d971ace59c 100644 (file)
@@ -1555,16 +1555,16 @@ If SPEC is nil, return nil."
                :box nil :inverse-video nil :stipple nil :inherit nil)
              ;; `display-graphic-p' is unavailable when running
              ;; temacs, prior to loading frame.el.
-             (unless (and (fboundp 'display-graphic-p)
-                          (display-graphic-p frame))
-               `(:family "default" :foundry "default" :width normal
-                 :height 1 :weight normal :slant normal
-                 :foreground ,(if (frame-parameter nil 'reverse)
-                                  "unspecified-bg"
-                                "unspecified-fg")
-                 :background ,(if (frame-parameter nil 'reverse)
-                                  "unspecified-fg"
-                                "unspecified-bg"))))
+             (when (fboundp 'display-graphic-p)
+               (unless (display-graphic-p frame)
+                 `(:family "default" :foundry "default" :width normal
+                   :height 1 :weight normal :slant normal
+                   :foreground ,(if (frame-parameter nil 'reverse)
+                                    "unspecified-bg"
+                                  "unspecified-fg")
+                   :background ,(if (frame-parameter nil 'reverse)
+                                    "unspecified-fg"
+                                  "unspecified-bg")))))
           ;; For all other faces, unspecify all attributes.
           (apply 'append
                  (mapcar (lambda (x) (list (car x) 'unspecified))
@@ -1574,13 +1574,13 @@ If SPEC is nil, return nil."
   "Set the face spec SPEC for FACE.
 See `defface' for the format of SPEC.
 
-The appearance of each face is controlled by its spec, and by the
-internal face attributes (which can be frame-specific and can be
-set via `set-face-attribute').  This function sets the former.
+The appearance of each face is controlled by its specs (set via
+this function), and by the internal frame-specific face
+attributes (set via `set-face-attribute').
 
-In addition to setting the face spec, this function defines FACE
-as a valid face name if it is not already one, and (re)calculates
-the face's attributes on existing frames.
+This function also defines FACE as a valid face name if it is not
+already one, and (re)calculates its attributes on existing
+frames.
 
 The argument SPEC-TYPE determines which spec to set:
   nil or `face-override-spec' means the override spec (which is
@@ -1612,20 +1612,10 @@ function for its other effects."
   ;; as far as Custom is concerned.
   (unless (eq face 'face-override-spec)
     (put face 'face-modified nil))
-  (if (facep face)
-      ;; If the face already exists, recalculate it.
-      (dolist (frame (frame-list))
-       (face-spec-recalc face frame))
-    ;; Otherwise, initialize it on all frames.
-    (make-empty-face face)
-    (let ((value (face-user-default-spec face))
-         (have-window-system (memq initial-window-system '(x w32 ns))))
-      (dolist (frame (frame-list))
-       (face-spec-set-2 face frame value)
-       (when (memq (window-system frame) '(x w32 ns))
-         (setq have-window-system t)))
-      (if have-window-system
-         (make-face-x-resource-internal face)))))
+  ;; Initialize the face if it does not exist, then recalculate.
+  (make-empty-face face)
+  (dolist (frame (frame-list))
+    (face-spec-recalc face frame)))
 
 (defun face-spec-recalc (face frame)
   "Reset the face attributes of FACE on FRAME according to its specs.
@@ -1642,7 +1632,8 @@ then the override spec."
        (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)))
+  (face-spec-set-2 face frame (get face 'face-override-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."