aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChong Yidong2013-12-21 23:31:09 +0800
committerChong Yidong2013-12-21 23:31:09 +0800
commitaac2b673c3083ab612bcd57fbcd9d370078bd8da (patch)
treed5fc1b92e5f70e0d3af72467df2b3bf7e476f908
parentbacb0e7791b68b1b0a254c09910d666087a386b5 (diff)
downloademacs-aac2b673c3083ab612bcd57fbcd9d370078bd8da.tar.gz
emacs-aac2b673c3083ab612bcd57fbcd9d370078bd8da.zip
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.
-rw-r--r--lisp/ChangeLog13
-rw-r--r--lisp/custom.el11
-rw-r--r--lisp/faces.el53
3 files changed, 40 insertions, 37 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 0e452aa6686..c81dbf2889a 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,11 +1,20 @@
12013-12-21 Chong Yidong <cyd@gnu.org> 12013-12-21 Chong Yidong <cyd@gnu.org>
2 2
3 * custom.el (custom-theme-recalc-face): Do nothing if the face is
4 undefined. Thus, theme settings for undefined faces do not take
5 effect until the faces are defined with defface, the same as with
6 theme variables.
7
8 * faces.el (face-spec-set): Use face-spec-recalc in all cases.
9 (face-spec-reset-face): Don't assign extra properties in temacs.
10 (face-spec-recalc): Apply X resources too.
11
122013-12-21 Chong Yidong <cyd@gnu.org>
13
3 * faces.el (face-spec-set): 14 * faces.el (face-spec-set):
4 * cus-face.el (custom-theme-set-faces, custom-set-faces): 15 * cus-face.el (custom-theme-set-faces, custom-set-faces):
5 * custom.el (defface): Doc fixes (Bug#16203). 16 * custom.el (defface): Doc fixes (Bug#16203).
6 17
72013-12-21 Chong Yidong <cyd@gnu.org>
8
9 * indent.el (indent-rigidly-map): Add docstring, and move commands 18 * indent.el (indent-rigidly-map): Add docstring, and move commands
10 into named functions. 19 into named functions.
11 (indent-rigidly-left, indent-rigidly-right) 20 (indent-rigidly-left, indent-rigidly-right)
diff --git a/lisp/custom.el b/lisp/custom.el
index 8b675c4a743..58477a58ad3 100644
--- a/lisp/custom.el
+++ b/lisp/custom.el
@@ -1459,12 +1459,15 @@ This function returns nil if no custom theme specifies a value for VARIABLE."
1459 (eval (car valspec)))))) 1459 (eval (car valspec))))))
1460 1460
1461(defun custom-theme-recalc-face (face) 1461(defun custom-theme-recalc-face (face)
1462 "Set FACE according to currently enabled custom themes." 1462 "Set FACE according to currently enabled custom themes.
1463If FACE is not initialized as a face, do nothing; otherwise call
1464`face-spec-recalc' to recalculate the face on all frames."
1463 (if (get face 'face-alias) 1465 (if (get face 'face-alias)
1464 (setq face (get face 'face-alias))) 1466 (setq face (get face 'face-alias)))
1465 ;; Reset the faces for each frame. 1467 (if (facep face)
1466 (dolist (frame (frame-list)) 1468 ;; Reset the faces for each frame.
1467 (face-spec-recalc face frame))) 1469 (dolist (frame (frame-list))
1470 (face-spec-recalc face frame))))
1468 1471
1469 1472
1470;;; XEmacs compatibility functions 1473;;; XEmacs compatibility functions
diff --git a/lisp/faces.el b/lisp/faces.el
index 403cf8b1b9a..13283665781 100644
--- a/lisp/faces.el
+++ b/lisp/faces.el
@@ -1555,16 +1555,16 @@ If SPEC is nil, return nil."
1555 :box nil :inverse-video nil :stipple nil :inherit nil) 1555 :box nil :inverse-video nil :stipple nil :inherit nil)
1556 ;; `display-graphic-p' is unavailable when running 1556 ;; `display-graphic-p' is unavailable when running
1557 ;; temacs, prior to loading frame.el. 1557 ;; temacs, prior to loading frame.el.
1558 (unless (and (fboundp 'display-graphic-p) 1558 (when (fboundp 'display-graphic-p)
1559 (display-graphic-p frame)) 1559 (unless (display-graphic-p frame)
1560 `(:family "default" :foundry "default" :width normal 1560 `(:family "default" :foundry "default" :width normal
1561 :height 1 :weight normal :slant normal 1561 :height 1 :weight normal :slant normal
1562 :foreground ,(if (frame-parameter nil 'reverse) 1562 :foreground ,(if (frame-parameter nil 'reverse)
1563 "unspecified-bg" 1563 "unspecified-bg"
1564 "unspecified-fg") 1564 "unspecified-fg")
1565 :background ,(if (frame-parameter nil 'reverse) 1565 :background ,(if (frame-parameter nil 'reverse)
1566 "unspecified-fg" 1566 "unspecified-fg"
1567 "unspecified-bg")))) 1567 "unspecified-bg")))))
1568 ;; For all other faces, unspecify all attributes. 1568 ;; For all other faces, unspecify all attributes.
1569 (apply 'append 1569 (apply 'append
1570 (mapcar (lambda (x) (list (car x) 'unspecified)) 1570 (mapcar (lambda (x) (list (car x) 'unspecified))
@@ -1574,13 +1574,13 @@ If SPEC is nil, return nil."
1574 "Set the face spec SPEC for FACE. 1574 "Set the face spec SPEC for FACE.
1575See `defface' for the format of SPEC. 1575See `defface' for the format of SPEC.
1576 1576
1577The appearance of each face is controlled by its spec, and by the 1577The appearance of each face is controlled by its specs (set via
1578internal face attributes (which can be frame-specific and can be 1578this function), and by the internal frame-specific face
1579set via `set-face-attribute'). This function sets the former. 1579attributes (set via `set-face-attribute').
1580 1580
1581In addition to setting the face spec, this function defines FACE 1581This function also defines FACE as a valid face name if it is not
1582as a valid face name if it is not already one, and (re)calculates 1582already one, and (re)calculates its attributes on existing
1583the face's attributes on existing frames. 1583frames.
1584 1584
1585The argument SPEC-TYPE determines which spec to set: 1585The argument SPEC-TYPE determines which spec to set:
1586 nil or `face-override-spec' means the override spec (which is 1586 nil or `face-override-spec' means the override spec (which is
@@ -1612,20 +1612,10 @@ function for its other effects."
1612 ;; as far as Custom is concerned. 1612 ;; as far as Custom is concerned.
1613 (unless (eq face 'face-override-spec) 1613 (unless (eq face 'face-override-spec)
1614 (put face 'face-modified nil)) 1614 (put face 'face-modified nil))
1615 (if (facep face) 1615 ;; Initialize the face if it does not exist, then recalculate.
1616 ;; If the face already exists, recalculate it. 1616 (make-empty-face face)
1617 (dolist (frame (frame-list)) 1617 (dolist (frame (frame-list))
1618 (face-spec-recalc face frame)) 1618 (face-spec-recalc face frame)))
1619 ;; Otherwise, initialize it on all frames.
1620 (make-empty-face face)
1621 (let ((value (face-user-default-spec face))
1622 (have-window-system (memq initial-window-system '(x w32 ns))))
1623 (dolist (frame (frame-list))
1624 (face-spec-set-2 face frame value)
1625 (when (memq (window-system frame) '(x w32 ns))
1626 (setq have-window-system t)))
1627 (if have-window-system
1628 (make-face-x-resource-internal face)))))
1629 1619
1630(defun face-spec-recalc (face frame) 1620(defun face-spec-recalc (face frame)
1631 "Reset the face attributes of FACE on FRAME according to its specs. 1621 "Reset the face attributes of FACE on FRAME according to its specs.
@@ -1642,7 +1632,8 @@ then the override spec."
1642 (dolist (spec (reverse theme-faces)) 1632 (dolist (spec (reverse theme-faces))
1643 (face-spec-set-2 face frame (cadr spec))) 1633 (face-spec-set-2 face frame (cadr spec)))
1644 (face-spec-set-2 face frame (face-default-spec face)))) 1634 (face-spec-set-2 face frame (face-default-spec face))))
1645 (face-spec-set-2 face frame (get face 'face-override-spec))) 1635 (face-spec-set-2 face frame (get face 'face-override-spec))
1636 (make-face-x-resource-internal face frame))
1646 1637
1647(defun face-spec-set-2 (face frame spec) 1638(defun face-spec-set-2 (face frame spec)
1648 "Set the face attributes of FACE on FRAME according to SPEC." 1639 "Set the face attributes of FACE on FRAME according to SPEC."