emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] trunk r115663: Don't make faces when loading Custom themes


From: Chong Yidong
Subject: [Emacs-diffs] trunk r115663: Don't make faces when loading Custom themes.
Date: Sat, 21 Dec 2013 15:31:30 +0000
User-agent: Bazaar (2.6b2)

------------------------------------------------------------
revno: 115663
revision-id: address@hidden
parent: address@hidden
committer: Chong Yidong <address@hidden>
branch nick: trunk
timestamp: Sat 2013-12-21 23:31:09 +0800
message:
  Don't make faces when loading Custom themes.
  
  * 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.
modified:
  lisp/ChangeLog                 changelog-20091113204419-o5vbwnq5f7feedwu-1432
  lisp/custom.el                 custom.el-20091113204419-o5vbwnq5f7feedwu-1093
  lisp/faces.el                  faces.el-20091113204419-o5vbwnq5f7feedwu-562
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog    2013-12-21 13:44:20 +0000
+++ b/lisp/ChangeLog    2013-12-21 15:31:09 +0000
@@ -1,11 +1,20 @@
 2013-12-21  Chong Yidong  <address@hidden>
 
+       * 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  <address@hidden>
+
        * 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  <address@hidden>
-
        * indent.el (indent-rigidly-map): Add docstring, and move commands
        into named functions.
        (indent-rigidly-left, indent-rigidly-right)

=== modified file 'lisp/custom.el'
--- a/lisp/custom.el    2013-12-21 13:44:20 +0000
+++ b/lisp/custom.el    2013-12-21 15:31:09 +0000
@@ -1459,12 +1459,15 @@
                 (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))))
 
 
 ;;; XEmacs compatibility functions

=== modified file 'lisp/faces.el'
--- a/lisp/faces.el     2013-12-21 13:44:20 +0000
+++ b/lisp/faces.el     2013-12-21 15:31:09 +0000
@@ -1555,16 +1555,16 @@
                :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 @@
   "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 @@
   ;; 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 @@
        (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."


reply via email to

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