summaryrefslogtreecommitdiff
path: root/lisp
diff options
context:
space:
mode:
authorChong Yidong <cyd@stupidchicken.com>2011-05-08 16:07:38 -0400
committerChong Yidong <cyd@stupidchicken.com>2011-05-08 16:07:38 -0400
commit027f966de45d5cbcc01e3ee5ac9a667908ea3f54 (patch)
tree8ec2ce61886ce928ad7c626b1dbc64ace7453834 /lisp
parent2a86a00c4fbd998fedf778c65764f607f7da1855 (diff)
downloademacs-027f966de45d5cbcc01e3ee5ac9a667908ea3f54.tar.gz
Handle calling defface on a face with existing theme settings (Bug#8454).
* lisp/cus-face.el (custom-declare-face): Call custom-theme-recalc-face if the face has existing theme settings.
Diffstat (limited to 'lisp')
-rw-r--r--lisp/ChangeLog5
-rw-r--r--lisp/cus-face.el34
2 files changed, 23 insertions, 16 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 488bd07a632..60b462e106b 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,8 @@
+2011-05-08 Chong Yidong <cyd@stupidchicken.com>
+
+ * cus-face.el (custom-declare-face): Call custom-theme-recalc-face
+ if the face has existing theme settings (Bug#8454).
+
2011-05-08 Ralph Schleicher <rs@ralph-schleicher.de>
* progmodes/perl-mode.el (perl-imenu-generic-expression): Only
diff --git a/lisp/cus-face.el b/lisp/cus-face.el
index f813b5b84d1..90f21f32149 100644
--- a/lisp/cus-face.el
+++ b/lisp/cus-face.el
@@ -34,28 +34,30 @@
(defun custom-declare-face (face spec doc &rest args)
"Like `defface', but FACE is evaluated as a normal argument."
(unless (get face 'face-defface-spec)
- (when (fboundp 'facep)
- (unless (facep face)
- ;; If the user has already created the face, respect that.
- (let ((value (or (get face 'saved-face) spec))
- (have-window-system (memq initial-window-system '(x w32))))
- ;; Create global face.
- (make-empty-face face)
- ;; Create frame-local faces
- (dolist (frame (frame-list))
- (face-spec-set-2 face frame value)
- (when (memq (window-system frame) '(x w32 ns))
- (setq have-window-system t)))
- ;; When making a face after frames already exist
- (if have-window-system
- (make-face-x-resource-internal face)))))
+ (unless (facep face)
+ ;; If the user has already created the face, respect that.
+ (let ((value (or (get face 'saved-face) spec))
+ (have-window-system (memq initial-window-system '(x w32))))
+ ;; Create global face.
+ (make-empty-face face)
+ ;; Create frame-local faces
+ (dolist (frame (frame-list))
+ (face-spec-set-2 face frame value)
+ (when (memq (window-system frame) '(x w32 ns))
+ (setq have-window-system t)))
+ ;; When making a face after frames already exist
+ (if have-window-system
+ (make-face-x-resource-internal face))))
;; Don't record SPEC until we see it causes no errors.
(put face 'face-defface-spec (purecopy spec))
(push (cons 'defface face) current-load-list)
(when (and doc (null (face-documentation face)))
(set-face-documentation face (purecopy doc)))
(custom-handle-all-keywords face args 'custom-face)
- (run-hooks 'custom-define-hook))
+ (run-hooks 'custom-define-hook)
+ ;; If the face has an existing theme setting, recalculate it.
+ (if (get face 'theme-face)
+ (custom-theme-recalc-face face)))
face)
;;; Face attributes.