aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKen Raeburn2015-10-13 22:06:01 -0400
committerKen Raeburn2015-10-13 22:12:55 -0400
commit9fa9c26e42ddb3f67133bc18112147926bae8a50 (patch)
treea7bc2ac4daefb0a1410fb50885d6c394d07d3087
parent85c12310ff9a6721fb1ecbfdf6d89e59a34fb882 (diff)
downloademacs-9fa9c26e42ddb3f67133bc18112147926bae8a50.tar.gz
emacs-9fa9c26e42ddb3f67133bc18112147926bae8a50.zip
Reduce face-related consing during frame creation.
* faces.el (face--attributes-unspecified): Compute the "unspecified" attribute list once. (face-spec-reset-face): Use it instead of building the list.
-rw-r--r--lisp/faces.el11
1 files changed, 8 insertions, 3 deletions
diff --git a/lisp/faces.el b/lisp/faces.el
index 4e7f1a42bff..de8a0b5bcb1 100644
--- a/lisp/faces.el
+++ b/lisp/faces.el
@@ -1598,6 +1598,13 @@ is given, in which case return its value instead."
1598 result 1598 result
1599 no-match-retval)))) 1599 no-match-retval))))
1600 1600
1601;; When over 80 faces get processed at frame creation time, all but
1602;; one specifying all attributes as "unspecified", generating this
1603;; list every time means a lot of consing.
1604(defconst face--attributes-unspecified
1605 (apply 'append
1606 (mapcar (lambda (x) (list (car x) 'unspecified))
1607 face-attribute-name-alist)))
1601 1608
1602(defun face-spec-reset-face (face &optional frame) 1609(defun face-spec-reset-face (face &optional frame)
1603 "Reset all attributes of FACE on FRAME to unspecified." 1610 "Reset all attributes of FACE on FRAME to unspecified."
@@ -1622,9 +1629,7 @@ is given, in which case return its value instead."
1622 "unspecified-fg" 1629 "unspecified-fg"
1623 "unspecified-bg"))))) 1630 "unspecified-bg")))))
1624 ;; For all other faces, unspecify all attributes. 1631 ;; For all other faces, unspecify all attributes.
1625 (apply 'append 1632 face--attributes-unspecified)))
1626 (mapcar (lambda (x) (list (car x) 'unspecified))
1627 face-attribute-name-alist)))))
1628 1633
1629(defun face-spec-set (face spec &optional spec-type) 1634(defun face-spec-set (face spec &optional spec-type)
1630 "Set the face spec SPEC for FACE. 1635 "Set the face spec SPEC for FACE.