X-Git-Url: http://git.hcoop.net/bpt/emacs.git/blobdiff_plain/362b9d483c714a8fd87966ddbd8686850f870e34..48093eb9bca47488b6867e53a12e7cac37d6f5a6:/lisp/cus-face.el diff --git a/lisp/cus-face.el b/lisp/cus-face.el index befccf8a7e..06fd10149d 100644 --- a/lisp/cus-face.el +++ b/lisp/cus-face.el @@ -1,7 +1,6 @@ ;;; cus-face.el --- customization support for faces ;; -;; Copyright (C) 1996, 1997, 1999, 2000, 2001, 2002, 2003, 2004, -;; 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc. +;; Copyright (C) 1996-1997, 1999-2012 Free Software Foundation, Inc. ;; ;; Author: Per Abrahamsen ;; Keywords: help, faces @@ -35,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)))) @@ -49,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. @@ -131,8 +135,37 @@ (choice :tag "Underline" :help-echo "Control text underlining." (const :tag "Off" nil) - (const :tag "On" t) - (color :tag "Colored"))) + (list :tag "On" + :value (:color foreground-color :style line) + (const :format "" :value :color) + (choice :tag "Color" + (const :tag "Foreground Color" foreground-color) + color) + (const :format "" :value :style) + (choice :tag "Style" + (const :tag "Line" line) + (const :tag "Wave" wave)))) + ;; filter to make value suitable for customize + (lambda (real-value) + (and real-value + (let ((color + (or (and (consp real-value) (plist-get real-value :color)) + (and (stringp real-value) real-value) + 'foreground-color)) + (style + (or (and (consp real-value) (plist-get real-value :style)) + 'line))) + (list :color color :style style)))) + ;; filter to make customized-value suitable for storing + (lambda (cus-value) + (and cus-value + (let ((color (plist-get cus-value :color)) + (style (plist-get cus-value :style))) + (cond ((eq style 'line) + ;; Use simple value for default style + (if (eq color 'foreground-color) t color)) + (t + `(:color ,color :style ,style))))))) (:overline (choice :tag "Overline" @@ -349,7 +382,7 @@ FACE's list property `theme-face' \(using `custom-push-theme')." (put face 'face-override-spec nil) (face-spec-set face spec t)))))))) -;; XEmacs compability function. In XEmacs, when you reset a Custom +;; XEmacs compatibility function. In XEmacs, when you reset a Custom ;; Theme, you have to specify the theme to reset it to. We just apply ;; the next theme. (defun custom-theme-reset-faces (theme &rest args) @@ -378,5 +411,4 @@ This means reset FACE to its value in FROM-THEME." (provide 'cus-face) -;; arch-tag: 9a5c4b63-0d27-4c92-a5af-f2c7ed764c2b ;;; cus-face.el ends here