X-Git-Url: https://code.delx.au/gnu-emacs/blobdiff_plain/f7ff1b0f0792f1f870778404531e68e77832c4a1..d372248073cecc1d8ae1d6bed826692eab16274d:/lisp/cus-face.el diff --git a/lisp/cus-face.el b/lisp/cus-face.el index f813b5b84d..d725111b6f 100644 --- a/lisp/cus-face.el +++ b/lisp/cus-face.el @@ -1,6 +1,6 @@ ;;; cus-face.el --- customization support for faces ;; -;; Copyright (C) 1996-1997, 1999-2011 Free Software Foundation, Inc. +;; Copyright (C) 1996-1997, 1999-2012 Free Software Foundation, Inc. ;; ;; Author: Per Abrahamsen ;; Keywords: help, faces @@ -34,8 +34,8 @@ (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) + (let ((facep (facep face))) + (unless facep ;; 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)))) @@ -48,14 +48,19 @@ (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)) + (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) + ;; If the face had existing settings, recalculate it. For + ;; example, the user might load a theme with a face setting, and + ;; later load a library defining that face. + (if facep + (custom-theme-recalc-face face)))) face) ;;; Face attributes.