(x-clipboard-yank): Specify * in interactive spec.
[bpt/emacs.git] / lisp / faces.el
index 81a6a95..fe2f503 100644 (file)
@@ -1,7 +1,7 @@
 ;;; faces.el --- Lisp faces
 
 ;; Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
-;;   2002, 2003, 2004, 2005 Free Software Foundation, Inc.
+;;   2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
 
 ;; Maintainer: FSF
 ;; Keywords: internal
@@ -374,8 +374,11 @@ completely specified)."
       ;; VALUE is relative, so merge with inherited faces
       (let ((inh-from (face-attribute face :inherit frame)))
        (unless (or (null inh-from) (eq inh-from 'unspecified))
-         (setq value
-               (face-attribute-merged-with attribute value inh-from frame)))))
+          (condition-case nil
+              (setq value
+                    (face-attribute-merged-with attribute value inh-from frame))
+            ;; The `inherit' attribute may point to non existent faces.
+            (error nil)))))
     (when (and inherit
               (not (eq inherit t))
               (face-attribute-relative-p attribute value))
@@ -557,7 +560,7 @@ the default for new frames (this is done automatically each time an
 attribute is changed on all frames).
 
 ARGS must come in pairs ATTRIBUTE VALUE.  ATTRIBUTE must be a valid
-face attribute name.  All attributes can be set to `unspecified';
+face attribute name. All attributes can be set to `unspecified';
 this fact is not further mentioned below.
 
 The following attributes are recognized:
@@ -856,10 +859,11 @@ of the default face.  Value is FACE."
 
 (defun read-face-name (prompt &optional string-describing-default multiple)
   "Read a face, defaulting to the face or faces on the char after point.
-If it has a `read-face-name' property, that overrides the `face' property.
-PROMPT describes what you will do with the face (don't end in a space).
-STRING-DESCRIBING-DEFAULT describes what default you will use
-if this function returns nil.
+If it has the property `read-face-name', that overrides the `face' property.
+PROMPT should be a string that describes what the caller will do with the face;
+it should not end in a space.
+STRING-DESCRIBING-DEFAULT should describe what default the caller will use if
+the user just types RET; you can omit it.
 If MULTIPLE is non-nil, return a list of faces (possibly only one).
 Otherwise, return a single face."
   (let ((faceprop (or (get-char-property (point) 'read-face-name)
@@ -1016,7 +1020,7 @@ Value is the new attribute value."
                     (format "%s for face `%s' (default %s): "
                             name face default)
                   (format "%s for face `%s': " name face))
-                completion-alist)))
+                completion-alist nil nil nil nil default)))
     (if (equal value "") default value)))
 
 
@@ -1445,7 +1449,7 @@ FRAME is the frame whose frame-local face is set.  FRAME nil means
 do it on all frames.  See `defface' for information about SPEC.
 If SPEC is nil, do nothing."
   (let ((attrs (face-spec-choose spec frame)))
-    (when attrs
+    (when spec
       (face-spec-reset-face face frame))
     (while attrs
       (let ((attribute (car attrs))
@@ -1514,7 +1518,8 @@ If there is neither a user setting nor a default for FACE, return nil."
   "Return a list of colors supported for a particular frame.
 The argument FRAME specifies which frame to try.
 The value may be different for frames on different display types.
-If FRAME doesn't support colors, the value is nil."
+If FRAME doesn't support colors, the value is nil.
+If FRAME is nil, that stands for the selected frame."
   (if (memq (framep (or frame (selected-frame))) '(x w32 mac))
       (xw-defined-colors frame)
     (mapcar 'car (tty-color-alist frame))))
@@ -1574,17 +1579,17 @@ If omitted or nil, that stands for the selected frame's display."
 (defcustom frame-background-mode nil
   "*The brightness of the background.
 Set this to the symbol `dark' if your background color is dark,
-`light' if your background is light, or nil (default) if you want Emacs
-to examine the brightness for you.  Don't set this variable with `setq';
-this won't have the expected effect."
+`light' if your background is light, or nil (automatic by default)
+if you want Emacs to examine the brightness for you.  Don't set this
+variable with `setq'; this won't have the expected effect."
   :group 'faces
   :set #'(lambda (var value)
           (set-default var value)
           (mapc 'frame-set-background-mode (frame-list)))
   :initialize 'custom-initialize-changed
-  :type '(choice (choice-item dark)
-                (choice-item light)
-                (choice-item :tag "default" nil)))
+  :type '(choice (const dark)
+                (const light)
+                (const :tag "automatic" nil)))
 
 (defvar default-frame-background-mode nil
   "Internal variable for the default brightness of the background.
@@ -1914,6 +1919,28 @@ created."
   :group 'basic-faces
   :version "22.1")
 
+(defface link
+  '((((class color) (min-colors 88) (background light))
+     :foreground "blue1" :underline t)
+    (((class color) (background light))
+     :foreground "blue" :underline t)
+    (((class color) (min-colors 88) (background dark))
+     :foreground "cyan1" :underline t)
+    (((class color) (background dark))
+     :foreground "cyan" :underline t)
+    (t :inherit underline))
+  "Basic face for unvisited links."
+  :group 'basic-faces
+  :version "22.1")
+
+(defface link-visited
+  '((default :inherit link)
+    (((class color) (background light)) :foreground "magenta4")
+    (((class color) (background dark)) :foreground "violet"))
+  "Basic face for visited links."
+  :group 'basic-faces
+  :version "22.1")
+
 (defface highlight
   '((((class color) (min-colors 88) (background light))
      :background "darkseagreen2")
@@ -1929,16 +1956,6 @@ created."
   "Basic face for highlighting."
   :group 'basic-faces)
 
-(defface mode-line-highlight
-  '((((class color) (min-colors 88))
-     :box (:line-width 2 :color "grey40" :style released-button))
-    (t
-     :inherit highlight))
-  "Basic mode line face for highlighting."
-  :version "22.1"
-  :group 'modeline
-  :group 'basic-faces)
-
 (defface region
   '((((class color) (min-colors 88) (background dark))
      :background "blue3")
@@ -1980,7 +1997,7 @@ created."
     (t :inverse-video t))
   "Basic face for highlighting trailing whitespace."
   :version "21.1"
-  :group 'whitespace           ; like `show-trailing-whitespace'
+  :group 'whitespace-faces     ; like `show-trailing-whitespace'
   :group 'basic-faces)
 
 (defface escape-glyph
@@ -1991,7 +2008,7 @@ created."
     ;; red4 is too dark, but some say blue is too loud.
     ;; brown seems to work ok. -- rms.
     (t :foreground "brown"))
-  "Face for characters displayed as ^-sequences or \-sequences."
+  "Face for characters displayed as sequences using `^' or `\\'."
   :group 'basic-faces
   :version "22.1")
 
@@ -2003,6 +2020,12 @@ created."
   :group 'basic-faces
   :version "22.1")
 
+(defgroup mode-line-faces nil
+  "Faces used in the mode line."
+  :group 'modeline
+  :group 'faces
+  :version "22.1")
+
 (defface mode-line
   '((((class color) (min-colors 88))
      :box (:line-width -1 :style released-button)
@@ -2011,7 +2034,7 @@ created."
      :inverse-video t))
   "Basic mode line face for selected window."
   :version "21.1"
-  :group 'modeline
+  :group 'mode-line-faces
   :group 'basic-faces)
 
 (defface mode-line-inactive
@@ -2027,13 +2050,31 @@ created."
      :foreground "grey80" :background "grey30"))
   "Basic mode line face for non-selected windows."
   :version "22.1"
-  :group 'modeline
+  :group 'mode-line-faces
+  :group 'basic-faces)
+
+(defface mode-line-highlight
+  '((((class color) (min-colors 88))
+     :box (:line-width 2 :color "grey40" :style released-button))
+    (t
+     :inherit highlight))
+  "Basic mode line face for highlighting."
+  :version "22.1"
+  :group 'mode-line-faces
+  :group 'basic-faces)
+
+(defface mode-line-buffer-id
+  '((t (:weight bold)))
+  "Face used for buffer identification parts of the mode line."
+  :version "22.1"
+  :group 'mode-line-faces
   :group 'basic-faces)
 
 ;; Make `modeline' an alias for `mode-line', for compatibility.
 (put 'modeline 'face-alias 'mode-line)
 (put 'modeline-inactive 'face-alias 'mode-line-inactive)
 (put 'modeline-highlight 'face-alias 'mode-line-highlight)
+(put 'modeline-buffer-id 'face-alias 'mode-line-buffer-id)
 
 (defface header-line
   '((default
@@ -2074,7 +2115,6 @@ created."
   '((((type tty)) :inherit mode-line-inactive))
   "Face used for vertical window dividers on ttys."
   :version "22.1"
-  :group 'modeline
   :group 'basic-faces)
 
 (defface minibuffer-prompt
@@ -2105,19 +2145,19 @@ used to display the prompt text."
   :group 'frames
   :group 'basic-faces)
 
-(defface scroll-bar '()
+(defface scroll-bar '((t nil))
   "Basic face for the scroll bar colors under X."
   :version "21.1"
   :group 'frames
   :group 'basic-faces)
 
-(defface border '()
+(defface border '((t nil))
   "Basic face for the frame border under X."
   :version "21.1"
   :group 'frames
   :group 'basic-faces)
 
-(defface cursor '()
+(defface cursor '((t nil))
   "Basic face for the cursor color under X.
 Note: Other faces cannot inherit from the cursor face."
   :version "21.1"
@@ -2126,7 +2166,7 @@ Note: Other faces cannot inherit from the cursor face."
 
 (put 'cursor 'face-no-inherit t)
 
-(defface mouse '()
+(defface mouse '((t nil))
   "Basic face for the mouse color under X."
   :version "21.1"
   :group 'mouse