aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChong Yidong2011-05-08 16:07:38 -0400
committerChong Yidong2011-05-08 16:07:38 -0400
commit027f966de45d5cbcc01e3ee5ac9a667908ea3f54 (patch)
tree8ec2ce61886ce928ad7c626b1dbc64ace7453834
parent2a86a00c4fbd998fedf778c65764f607f7da1855 (diff)
downloademacs-027f966de45d5cbcc01e3ee5ac9a667908ea3f54.tar.gz
emacs-027f966de45d5cbcc01e3ee5ac9a667908ea3f54.zip
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.
-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 @@
12011-05-08 Chong Yidong <cyd@stupidchicken.com>
2
3 * cus-face.el (custom-declare-face): Call custom-theme-recalc-face
4 if the face has existing theme settings (Bug#8454).
5
12011-05-08 Ralph Schleicher <rs@ralph-schleicher.de> 62011-05-08 Ralph Schleicher <rs@ralph-schleicher.de>
2 7
3 * progmodes/perl-mode.el (perl-imenu-generic-expression): Only 8 * 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 @@
34(defun custom-declare-face (face spec doc &rest args) 34(defun custom-declare-face (face spec doc &rest args)
35 "Like `defface', but FACE is evaluated as a normal argument." 35 "Like `defface', but FACE is evaluated as a normal argument."
36 (unless (get face 'face-defface-spec) 36 (unless (get face 'face-defface-spec)
37 (when (fboundp 'facep) 37 (unless (facep face)
38 (unless (facep face) 38 ;; If the user has already created the face, respect that.
39 ;; If the user has already created the face, respect that. 39 (let ((value (or (get face 'saved-face) spec))
40 (let ((value (or (get face 'saved-face) spec)) 40 (have-window-system (memq initial-window-system '(x w32))))
41 (have-window-system (memq initial-window-system '(x w32)))) 41 ;; Create global face.
42 ;; Create global face. 42 (make-empty-face face)
43 (make-empty-face face) 43 ;; Create frame-local faces
44 ;; Create frame-local faces 44 (dolist (frame (frame-list))
45 (dolist (frame (frame-list)) 45 (face-spec-set-2 face frame value)
46 (face-spec-set-2 face frame value) 46 (when (memq (window-system frame) '(x w32 ns))
47 (when (memq (window-system frame) '(x w32 ns)) 47 (setq have-window-system t)))
48 (setq have-window-system t))) 48 ;; When making a face after frames already exist
49 ;; When making a face after frames already exist 49 (if have-window-system
50 (if have-window-system 50 (make-face-x-resource-internal face))))
51 (make-face-x-resource-internal face)))))
52 ;; Don't record SPEC until we see it causes no errors. 51 ;; Don't record SPEC until we see it causes no errors.
53 (put face 'face-defface-spec (purecopy spec)) 52 (put face 'face-defface-spec (purecopy spec))
54 (push (cons 'defface face) current-load-list) 53 (push (cons 'defface face) current-load-list)
55 (when (and doc (null (face-documentation face))) 54 (when (and doc (null (face-documentation face)))
56 (set-face-documentation face (purecopy doc))) 55 (set-face-documentation face (purecopy doc)))
57 (custom-handle-all-keywords face args 'custom-face) 56 (custom-handle-all-keywords face args 'custom-face)
58 (run-hooks 'custom-define-hook)) 57 (run-hooks 'custom-define-hook)
58 ;; If the face has an existing theme setting, recalculate it.
59 (if (get face 'theme-face)
60 (custom-theme-recalc-face face)))
59 face) 61 face)
60 62
61;;; Face attributes. 63;;; Face attributes.