From: Richard M. Stallman Date: Tue, 31 Jul 2007 17:34:15 +0000 (+0000) Subject: (face-normalize-spec): New function. X-Git-Tag: emacs-pretest-22.1.90~1135 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=2d17b4d5dc5821d766bef1646461d31e6ab607e6;p=emacs.git (face-normalize-spec): New function. (frame-set-background-mode): Normalize face-spec before calling face-spec-match-p. --- diff --git a/lisp/ChangeLog b/lisp/ChangeLog index dc0c05462c8..066ae1fef13 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,9 @@ +2007-07-31 Daiki Ueno + + * faces.el (face-normalize-spec): New function. + (frame-set-background-mode): Normalize face-spec before calling + face-spec-match-p. + 2007-07-31 Stefan Monnier * vc-bzr.el: New file (copied from the trunk). diff --git a/lisp/faces.el b/lisp/faces.el index 090fbdba035..daf5f39fbc1 100644 --- a/lisp/faces.el +++ b/lisp/faces.el @@ -1505,6 +1505,28 @@ If there is neither a user setting nor a default for FACE, return nil." (get face 'saved-face) (face-default-spec face))) +(defsubst face-normalize-spec (spec) + "Return a normalized face-spec of SPEC." + (let (normalized-spec) + (while spec + (let ((attribute (car spec)) + (value (car (cdr spec)))) + ;; Support some old-style attribute names and values. + (case attribute + (:bold (setq attribute :weight value (if value 'bold 'normal))) + (:italic (setq attribute :slant value (if value 'italic 'normal))) + ((:foreground :background) + ;; Compatibility with 20.x. Some bogus face specs seem to + ;; exist containing things like `:foreground nil'. + (if (null value) (setq value 'unspecified))) + (t (unless (assq attribute face-x-resources) + (setq attribute nil)))) + (when attribute + (push attribute normalized-spec) + (push value normalized-spec))) + (setq spec (cdr (cdr spec)))) + (nreverse normalized-spec))) + ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;; Frame-type independent color support. @@ -1647,7 +1669,8 @@ according to the `background-mode' and `display-type' frame parameters." ;; be unmodified, so we can avoid consing in the common case. (dolist (face (face-list)) (when (not (face-spec-match-p face - (face-user-default-spec face) + (face-normalize-spec + (face-user-default-spec face)) (selected-frame))) (push face locally-modified-faces))) ;; Now change to the new frame parameters