]> code.delx.au - gnu-emacs/blobdiff - lisp/faces.el
Install a change I forgot to install at the last committing.
[gnu-emacs] / lisp / faces.el
index d60d30a46f638fab873985a7ca5009a34adb20cd..27905af734cc86c546b4db6d089f33a6ce65f84f 100644 (file)
@@ -1,9 +1,10 @@
 ;;; faces.el --- Lisp faces
 
-;; Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001
+;; Copyright (C) 1992,1993,1994,1995,1996,1998,1999,2000,2001,2002,2004
 ;;   Free Software Foundation, Inc.
 
 ;; Maintainer: FSF
+;; Keywords: internal
 
 ;; This file is part of GNU Emacs.
 
@@ -31,8 +32,6 @@
   ;; Warning suppression -- can't require x-win in batch:
   (autoload 'xw-defined-colors "x-win"))
 
-(require 'cus-face)
-
 \f
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;;; Font selection.
@@ -53,7 +52,7 @@ those face attributes first that appear first in the list.  For
 example, if `:slant' appears before `:height', font selection first
 tries to find a font with a suitable slant, even if this results in
 a font height that isn't optimal."
-  :tag "Font selection order."
+  :tag "Font selection order"
   :type '(list symbol symbol symbol symbol)
   :group 'font-selection
   :set #'(lambda (symbol value)
@@ -66,10 +65,10 @@ a font height that isn't optimal."
   '(("courier" "fixed")
     ("helv" "helvetica" "arial" "fixed"))
   "*Alist of alternative font family names.
-Each element has the the form (FAMILY ALTERNATIVE1 ALTERNATIVE2 ...).
+Each element has the form (FAMILY ALTERNATIVE1 ALTERNATIVE2 ...).
 If fonts of family FAMILY can't be loaded, try ALTERNATIVE1, then
 ALTERNATIVE2 etc."
-  :tag "Alternative font families to try."
+  :tag "Alternative font families to try"
   :type '(repeat (repeat string))
   :group 'font-selection
   :set #'(lambda (symbol value)
@@ -80,7 +79,8 @@ ALTERNATIVE2 etc."
 ;; This is defined originally in xfaces.c.
 (defcustom face-font-registry-alternatives
   (if (eq system-type 'windows-nt)
-      '(("gb2312.1980" "gb2312")
+      '(("iso8859-1" "ms-oemlatin")
+       ("gb2312.1980" "gb2312")
        ("jisx0208.1990" "jisx0208.1983" "jisx0208.1978")
        ("ksc5601.1989" "ksx1001.1992" "ksc5601.1987")
        ("muletibetan-2" "muletibetan-0"))
@@ -89,11 +89,11 @@ ALTERNATIVE2 etc."
       ("ksc5601.1989" "ksx1001.1992" "ksc5601.1987")
       ("muletibetan-2" "muletibetan-0")))
   "*Alist of alternative font registry names.
-Each element has the the form (REGISTRY ALTERNATIVE1 ALTERNATIVE2 ...).
+Each element has the form (REGISTRY ALTERNATIVE1 ALTERNATIVE2 ...).
 If fonts of registry REGISTRY can be loaded, font selection
 tries to find a best matching font among all fonts of registry
 REGISTRY, ALTERNATIVE1, ALTERNATIVE2, and etc."
-  :tag "Alternative font registries to try."
+  :tag "Alternative font registries to try"
   :type '(repeat (repeat string))
   :version "21.1"
   :group 'font-selection
@@ -148,7 +148,7 @@ If the face already exists, it is left unmodified.  Value is FACE."
 If NEW-FACE already exists as a face, it is modified to be like
 OLD-FACE.  If it doesn't already exist, it is created.
 
-If the optional argument FRAME is given as a frame,  NEW-FACE is
+If the optional argument FRAME is given as a frame, NEW-FACE is
 changed on FRAME only.
 If FRAME is t, the frame-independent default specification for OLD-FACE
 is copied to NEW-FACE.
@@ -196,13 +196,10 @@ should not be used anymore."
 If the optional argument FRAME is given, this gets the face NAME for
 that frame; otherwise, it uses the selected frame.
 If FRAME is the symbol t, then the global, non-frame face is returned.
-If NAME is already a face, it is simply returned.
-
-This function is defined for compatibility with Emacs 20.2.  It
-should not be used anymore."
+If NAME is already a face, it is simply returned."
   (or (facep name)
       (check-face name)))
-(make-obsolete 'internal-get-face "See `facep' and `check-face'." "21.1")
+(make-obsolete 'internal-get-face "see `facep' and `check-face'." "21.1")
 
 \f
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
@@ -227,8 +224,9 @@ Value is FACE."
 ;; support faces in display table entries.
 
 (defun face-id (face &optional frame)
-  "Return the interNal ID of face with name FACE.
-If optional argument FRAME is nil or omitted, use the selected frame."
+  "Return the internal ID of face with name FACE.
+The optional argument FRAME is ignored, since the internal face ID
+of a face name is the same for all frames."
   (check-face face)
   (get face 'face))
 
@@ -243,27 +241,24 @@ If FRAME is omitted or nil, use the selected frame."
 
 
 (defun face-differs-from-default-p (face &optional frame)
-  "Non-nil if FACE displays differently from the default face.
+  "Return non-nil if FACE displays differently from the default face.
 If the optional argument FRAME is given, report on face FACE in that frame.
 If FRAME is t, report on the defaults for face FACE (for new frames).
-If FRAME is omitted or nil, use the selected frame.
-A face is considered to be ``the same'' as the default face if it is
-actually specified in the same way (equal attributes) or if it is
-fully-unspecified, and thus inherits the attributes of any face it
-is displayed on top of."
-  (cond ((eq frame t) (setq frame nil))
-       ((null frame) (setq frame (selected-frame))))
-  (let* ((v1 (internal-lisp-face-p face frame))
-        (n (if v1 (length v1) 0))
-        (v2 (internal-lisp-face-p 'default frame))
-        (i 1))
-    (unless v1
-      (error "Not a face: %S" face))
-    (while (and (< i n)
-               (or (eq 'unspecified (aref v1 i))
-                   (equal (aref v1 i) (aref v2 i))))
-      (setq i (1+ i)))
-    (< i n)))
+If FRAME is omitted or nil, use the selected frame."
+  (let ((attrs
+        '(:family :width :height :weight :slant :foreground
+          :foreground :background :underline :overline
+          :strike-through :box :inverse-video))
+       (differs nil))
+    (while (and attrs (not differs))
+      (let* ((attr (pop attrs))
+            (attr-val (face-attribute face attr frame t)))
+       (when (and
+              (not (eq attr-val 'unspecified))
+              (display-supports-face-attributes-p (list attr attr-val)
+                                                  frame))
+         (setq differs attr))))
+    differs))
 
 
 (defun face-nontrivial-p (face &optional frame)
@@ -383,7 +378,7 @@ completely specified)."
     (when (and inherit
               (not (eq inherit t))
               (face-attribute-relative-p attribute value))
-       ;; We should merge with INHERIT as well
+      ;; We should merge with INHERIT as well
       (setq value (face-attribute-merged-with attribute value inherit frame)))
     value))
 
@@ -667,6 +662,9 @@ of face names.  Attributes from inherited faces are merged into the face
 like an underlying face would be, with higher priority than underlying faces."
   (let ((where (if (null frame) 0 frame)))
     (setq args (purecopy args))
+    ;; If we set the new-frame defaults, this face is modified outside Custom.
+    (if (memq where '(0 t))
+       (put face 'face-modified t))
     (while args
       (internal-set-lisp-face-attribute face (car args)
                                        (purecopy (cadr args))
@@ -733,7 +731,9 @@ and `:slant'.  When called interactively, prompt for the face and font."
 (defun set-face-background (face color &optional frame)
   "Change the background color of face FACE to COLOR (a string).
 FRAME nil or not specified means change face on all frames.
-When called interactively, prompt for the face and color."
+COLOR can be a system-defined color name (see `list-colors-display')
+or a hex spec of the form #RRGGBB.
+When called interactively, prompts for the face and color."
   (interactive (read-face-and-attribute :background))
   (set-face-attribute face frame :background (or color 'unspecified)))
 
@@ -741,7 +741,9 @@ When called interactively, prompt for the face and color."
 (defun set-face-foreground (face color &optional frame)
   "Change the foreground color of face FACE to COLOR (a string).
 FRAME nil or not specified means change face on all frames.
-When called interactively, prompt for the face and color."
+COLOR can be a system-defined color name (see `list-colors-display')
+or a hex spec of the form #RRGGBB.
+When called interactively, prompts for the face and color."
   (interactive (read-face-and-attribute :foreground))
   (set-face-attribute face frame :foreground (or color 'unspecified)))
 
@@ -845,21 +847,57 @@ of the default face.  Value is FACE."
 ;;; Interactively modifying faces.
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
-(defun read-face-name (prompt)
-  "Read and return a face symbol, prompting with PROMPT.
-PROMPT should not end with a blank, since this function appends one.
-Value is a symbol naming a known face."
-  (let ((face-list (mapcar #'(lambda (x) (cons (symbol-name x) x))
-                          (face-list)))
-       (def (thing-at-point 'symbol))
-       face)
-    (cond ((assoc def face-list)
-          (setq prompt (concat prompt " (default " def "): ")))
-         (t (setq def nil)
-            (setq prompt (concat prompt ": "))))
-    (while (equal "" (setq face (completing-read
-                                prompt face-list nil t nil nil def))))
-    (intern 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 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)
+                     (get-char-property (point) 'face)))
+       faces)
+    ;; Make a list of the named faces that the `face' property uses.
+    (if (and (listp faceprop)
+            ;; Don't treat an attribute spec as a list of faces.
+            (not (keywordp (car faceprop)))
+            (not (memq (car faceprop) '(foreground-color background-color))))
+       (dolist (f faceprop)
+         (if (symbolp f)
+             (push f faces)))
+      (if (symbolp faceprop)
+         (push faceprop faces)))
+    ;; If there are none, try to get a face name from the buffer.
+    (if (and (null faces)
+            (memq (intern-soft (thing-at-point 'symbol)) (face-list)))
+       (setq faces (list (intern-soft (thing-at-point 'symbol)))))
+
+    ;; If we only want one, and the default is more than one,
+    ;; discard the unwanted ones now.
+    (unless multiple
+      (if faces
+         (setq faces (list (car faces)))))
+    (let* ((input
+           ;; Read the input.
+           (completing-read
+            (if (or faces string-describing-default)
+                (format "%s (default %s): " prompt
+                        (if faces (mapconcat 'symbol-name faces ", ")
+                          string-describing-default))
+              (format "%s: " prompt))
+            obarray 'custom-facep t))
+          ;; Canonicalize the output.
+          (output
+           (if (equal input "")
+               faces
+             (if (stringp input)
+                 (list (intern input))
+               input))))
+      ;; Return either a list of faces or just one face.
+      (if multiple
+         output
+       (car output)))))
 
 
 (defun face-valid-attribute-values (attribute &optional frame)
@@ -976,7 +1014,7 @@ name of the attribute for prompting.  Value is the new attribute value."
          ((member new-value '("unspecified-fg" "unspecified-bg"))
           new-value)
          (t
-          (string-to-int new-value)))))
+          (string-to-number new-value)))))
 
 
 (defun read-face-attribute (face attribute &optional frame)
@@ -1038,7 +1076,7 @@ of a global face.  Value is the new attribute value."
 If optional argument FRAME Is nil or omitted, use the selected frame."
   (let ((completion-ignore-case t))
     (completing-read (format "Set font attributes of face `%s' from font: " face)
-                    (mapcar 'list (x-list-fonts "*" nil frame)))))
+                    (x-list-fonts "*" nil frame))))
 
 
 (defun read-all-face-attributes (face &optional frame)
@@ -1105,15 +1143,27 @@ Value is a list (FACE NEW-VALUE) where FACE is the face read
 ;; The name list-faces would be more consistent, but let's avoid a
 ;; conflict with Lucid, which uses that name differently.
 
-(defun list-faces-display ()
+(defvar help-xref-stack)
+(defun list-faces-display (&optional regexp)
   "List all faces, using the same sample text in each.
 The sample text is a string that comes from the variable
-`list-faces-sample-text'."
-  (interactive)
+`list-faces-sample-text'.
+
+If REGEXP is non-nil, list only those faces with names matching
+this regular expression.  When called interactively with a prefix
+arg, prompt for a regular expression."
+  (interactive (list (and current-prefix-arg
+                          (read-string "List faces matching regexp: "))))
   (let ((faces (sort (face-list) #'string-lessp))
-       (face nil)
        (frame (selected-frame))
        disp-frame window face-name)
+    (when (> (length regexp) 0)
+      (setq faces
+            (delq nil
+                  (mapcar (lambda (f)
+                            (when (string-match regexp (symbol-name f))
+                              f))
+                          faces))))
     (with-output-to-temp-buffer "*Faces*"
       (save-excursion
        (set-buffer standard-output)
@@ -1124,11 +1174,9 @@ The sample text is a string that comes from the variable
           "Use "
           (if (display-mouse-p) "\\[help-follow-mouse] or ")
           "\\[help-follow] on a face name to customize it\n"
-          "or on its sample text for a decription of the face.\n\n")))
+          "or on its sample text for a description of the face.\n\n")))
        (setq help-xref-stack nil)
-       (while faces
-         (setq face (car faces))
-         (setq faces (cdr faces))
+       (dolist (face faces)
          (setq face-name (symbol-name face))
          (insert (format "%25s " face-name))
          ;; Hyperlink to a customization buffer for the face.  Using
@@ -1136,8 +1184,10 @@ The sample text is a string that comes from the variable
          (save-excursion
            (save-match-data
              (search-backward face-name)
-             (help-xref-button 0 'help-customize-face face-name)))
-         (let ((beg (point)))
+             (setq help-xref-stack-item `(list-faces-display ,regexp))
+             (help-xref-button 0 'help-customize-face face)))
+         (let ((beg (point))
+               (line-beg (line-beginning-position)))
            (insert list-faces-sample-text)
            ;; Hyperlink to a help buffer for the face.
            (save-excursion
@@ -1146,6 +1196,9 @@ The sample text is a string that comes from the variable
                (help-xref-button 0 'help-face face)))
            (insert "\n")
            (put-text-property beg (1- (point)) 'face face)
+           ;; Make all face commands default to the proper face
+           ;; anywhere in the line.
+           (put-text-property line-beg (1- (point)) 'read-face-name face)
            ;; If the sample text has multiple lines, line up all of them.
            (goto-char beg)
            (forward-line 1)
@@ -1169,10 +1222,13 @@ The sample text is a string that comes from the variable
 
 (defun describe-face (face &optional frame)
   "Display the properties of face FACE on FRAME.
+Interactively, FACE defaults to the faces of the character after point
+and FRAME defaults to the selected frame.
+
 If the optional argument FRAME is given, report on face FACE in that frame.
 If FRAME is t, report on the defaults for face FACE (for new frames).
 If FRAME is omitted or nil, use the selected frame."
-  (interactive (list (read-face-name "Describe face")))
+  (interactive (list (read-face-name "Describe face" "= `default' face" t)))
   (let* ((attrs '((:family . "Family")
                  (:width . "Width")
                  (:height . "Height")
@@ -1191,25 +1247,48 @@ If FRAME is omitted or nil, use the selected frame."
        (max-width (apply #'max (mapcar #'(lambda (x) (length (cdr x)))
                                        attrs))))
     (help-setup-xref (list #'describe-face face) (interactive-p))
+    (unless face
+      (setq face 'default))
+    (if (not (listp face))
+       (setq face (list face)))
     (with-output-to-temp-buffer (help-buffer)
       (save-excursion
        (set-buffer standard-output)
-       (dolist (a attrs)
-         (let ((attr (face-attribute face (car a) frame)))
-           (insert (make-string (- max-width (length (cdr a))) ?\ )
-                   (cdr a) ": " (format "%s" attr) "\n")))
-       (insert "\nDocumentation:\n\n"
-               (or (face-documentation face)
-                   "not documented as a face."))
-       (let ((customize-label "customize"))
-         (terpri)
-         (terpri)
-         (princ (concat "You can " customize-label " this face."))
-         (with-current-buffer standard-output
-           (save-excursion
-             (re-search-backward
-              (concat "\\(" customize-label "\\)") nil t)
-             (help-xref-button 1 'help-customize-face face)))))
+       (dolist (f face)
+         (insert "Face: " (symbol-name f))
+         (if (not (facep f))
+             (insert "   undefined face.\n")
+           (let ((customize-label "customize this face")
+                 file-name)
+             (princ (concat " (" customize-label ")\n"))
+             (insert "Documentation: "
+                     (or (face-documentation f)
+                         "Not documented as a face.")
+                     "\n")
+             (with-current-buffer standard-output
+               (save-excursion
+                 (re-search-backward
+                  (concat "\\(" customize-label "\\)") nil t)
+                 (help-xref-button 1 'help-customize-face f)))
+             ;; The next 4 sexps are copied from describe-function-1
+             ;; and simplified.
+             (setq file-name (symbol-file f 'defface))
+             (when file-name
+               (princ "Defined in `")
+               (princ file-name)
+               (princ "'")
+               ;; Make a hyperlink to the library.
+               (save-excursion
+                 (re-search-backward "`\\([^`']+\\)'" nil t)
+                 (help-xref-button 1 'help-face-def f file-name))
+               (princ ".")
+               (terpri)
+               (terpri))
+             (dolist (a attrs)
+               (let ((attr (face-attribute f (car a) frame)))
+                 (insert (make-string (- max-width (length (cdr a))) ?\ )
+                         (cdr a) ": " (format "%s" attr) "\n")))))
+         (terpri)))
       (print-help-return-message))))
 
 \f
@@ -1261,16 +1340,23 @@ If FRAME is nil, the current FRAME is used."
                                  (memq 'tty options))
                             (and (memq 'motif options)
                                  (featurep 'motif))
+                            (and (memq 'gtk options)
+                                 (featurep 'gtk))
                             (and (memq 'lucid options)
                                  (featurep 'x-toolkit)
-                                 (not (featurep 'motif)))
+                                 (not (featurep 'motif))
+                                 (not (featurep 'gtk)))
                             (and (memq 'x-toolkit options)
                                  (featurep 'x-toolkit))))
+                       ((eq req 'min-colors)
+                        (>= (display-color-cells frame) (car options)))
                        ((eq req 'class)
                         (memq (frame-parameter frame 'display-type) options))
                        ((eq req 'background)
                         (memq (frame-parameter frame 'background-mode)
                               options))
+                       ((eq req 'supports)
+                        (display-supports-face-attributes-p options frame))
                        (t (error "Unknown req `%S' with options `%S'"
                                  req options)))))
     match))
@@ -1282,19 +1368,29 @@ If SPEC is nil, return nil."
   (unless frame
     (setq frame (selected-frame)))
   (let ((tail spec)
-       result)
+       result defaults)
     (while tail
       (let* ((entry (pop tail))
             (display (car entry))
-            (attrs (cdr entry)))
-       (when (face-spec-set-match-display display frame)
-         (setq result (if (listp (car attrs))
-                          ;; Old-style entry, the attribute list is the
-                          ;; first element.
-                          (car attrs)
-                        attrs)
-               tail nil))))
-    result))
+            (attrs (cdr entry))
+            thisval)
+       ;; Get the attributes as actually specified by this alternative.
+       (setq thisval
+             (if (null (cdr attrs)) ;; was (listp (car attrs))
+                 ;; Old-style entry, the attribute list is the
+                 ;; first element.
+                 (car attrs)
+               attrs))
+
+       ;; If the condition is `default', that sets the default
+       ;; for following conditions.
+       (if (eq display 'default)
+           (setq defaults thisval)
+         ;; Otherwise, if it matches, use it.
+         (when (face-spec-set-match-display display frame)
+           (setq result thisval)
+           (setq tail nil)))))
+    (if defaults (append result defaults) result)))
 
 
 (defun face-spec-reset-face (face &optional frame)
@@ -1329,7 +1425,11 @@ If SPEC is nil, do nothing."
               (setq attribute nil))))
        (when attribute
          (set-face-attribute face frame attribute value)))
-      (setq attrs (cdr (cdr attrs))))))
+      (setq attrs (cdr (cdr attrs)))))
+  ;; When we reset the face based on its spec, then it is unmodified
+  ;; as far as Custom is concerned.
+  (if (null frame)
+      (put face 'face-modified nil)))
 
 
 (defun face-attr-match-p (face attrs &optional frame)
@@ -1455,7 +1555,7 @@ Display-dependent faces are those which have different definitions
 according to the `background-mode' and `display-type' frame parameters."
   (let* ((bg-resource
          (and window-system
-              (x-get-resource ".backgroundMode" "BackgroundMode")))
+              (x-get-resource "backgroundMode" "BackgroundMode")))
         (bg-color (frame-parameter frame 'background-color))
         (bg-mode
          (cond (frame-background-mode)
@@ -1594,14 +1694,30 @@ Value is the new frame created."
 (defun face-set-after-frame-default (frame)
   "Set frame-local faces of FRAME from face specs and resources.
 Initialize colors of certain faces from frame parameters."
+  (if (face-attribute 'default :font t)
+      (set-face-attribute 'default frame :font
+                         (face-attribute 'default :font t))
+    (set-face-attribute 'default frame :family
+                       (face-attribute 'default :family t))
+    (set-face-attribute 'default frame :height
+                       (face-attribute 'default :height t))
+    (set-face-attribute 'default frame :slant
+                       (face-attribute 'default :slant t))
+    (set-face-attribute 'default frame :weight
+                       (face-attribute 'default :weight t))
+    (set-face-attribute 'default frame :width
+                       (face-attribute 'default :width t)))
   (dolist (face (face-list))
-    (face-spec-set face (face-user-default-spec face) frame)
-    (internal-merge-in-global-face face frame)
-    (when (and (memq window-system '(x w32 mac))
-              (or (not (boundp 'inhibit-default-face-x-resources))
-                  (not (eq face 'default))))
-      (make-face-x-resource-internal face frame)))
-
+    ;; Don't let frame creation fail because of an invalid face spec.
+    (condition-case ()
+       (when (not (equal face 'default))
+         (face-spec-set face (face-user-default-spec face) frame)
+         (internal-merge-in-global-face face frame)
+         (when (and (memq window-system '(x w32 mac))
+                    (or (not (boundp 'inhibit-default-face-x-resources))
+                        (not (eq face 'default))))
+           (make-face-x-resource-internal face frame)))
+      (error nil)))
   ;; Initialize attributes from frame parameters.
   (let ((params '((foreground-color default :foreground)
                  (background-color default :background)
@@ -1675,8 +1791,8 @@ created."
 
 ;; Update a frame's faces when we change its default font.
 
-(defalias 'frame-update-faces 'ignore)
-(make-obsolete 'frame-update-faces "No longer necessary" "21.1")
+(defalias 'frame-update-faces 'ignore "")
+(make-obsolete 'frame-update-faces "no longer necessary." "21.1")
 
 ;; Update the colors of FACE, after FRAME's own colors have been
 ;; changed.
@@ -1701,21 +1817,53 @@ created."
 
 
 (defface mode-line
-  '((((type x w32 mac) (class color))
-     (:box (:line-width -1 :style released-button)
-          :background "grey75" :foreground "black"))
+  '((((class color) (min-colors 88))
+     :box (:line-width -1 :style released-button)
+     :background "grey75" :foreground "black")
     (t
-     (:inverse-video t)))
-  "Basic mode line face."
+     :inverse-video t))
+  "Basic mode line face for selected window."
   :version "21.1"
   :group 'modeline
   :group 'basic-faces)
 
+(defface mode-line-inactive
+  '((default
+     :inherit mode-line)
+    (((class color) (min-colors 88) (background light))
+     :weight light
+     :box (:line-width -1 :color "grey75" :style nil)
+     :foreground "grey20" :background "grey90")
+    (((class color) (min-colors 88) (background dark) )
+     :weight light
+     :box (:line-width -1 :color "grey40" :style nil)
+     :foreground "grey80" :background "grey30"))
+  "Basic mode line face for non-selected windows."
+  :version "22.1"
+  :group 'modeline
+  :group 'basic-faces)
+
+(defface mode-line-highlight
+  '((((class color) (min-colors 88) (background light))
+      :background "RoyalBlue4" :foreground "white")
+     (((class color) (min-colors 88) (background dark))
+      :background "light sky blue" :foreground "black")
+     (t
+     :inverse-video t))
+  "Basic mode line face for highlighting."
+  :version "22.1"
+  :group 'modeline
+  :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-higilight 'face-alias 'mode-line-highlight)
 
 (defface header-line
-  '((((type tty))
+  '((default
+     :inherit mode-line)
+    (((type tty))
      ;; This used to be `:inverse-video t', but that doesn't look very
      ;; good when combined with inverse-video mode-lines and multiple
      ;; windows.  Underlining looks better, and is more consistent with
@@ -1725,58 +1873,69 @@ created."
      ;; highlighting; this may be too confusing in general, although it
      ;; happens to look good with the only current use of header-lines,
      ;; the info browser. XXX
+     :inverse-video nil               ;Override the value inherited from mode-line.
      :underline t)
     (((class color grayscale) (background light))
-     :inherit mode-line
      :background "grey90" :foreground "grey20"
      :box nil)
     (((class color grayscale) (background dark))
-     :inherit mode-line
      :background "grey20" :foreground "grey90"
      :box nil)
     (((class mono) (background light))
-     :inherit mode-line
      :background "white" :foreground "black"
      :inverse-video nil
      :box nil
      :underline t)
     (((class mono) (background dark))
-     :inherit mode-line
      :background "black" :foreground "white"
      :inverse-video nil
      :box nil
-     :underline t)
-    (t
-     :inverse-video t))
+     :underline t))
   "Basic header-line face."
   :version "21.1"
   :group 'basic-faces)
 
 
 (defface tool-bar
-  '((((type x w32 mac) (class color))
-     (:box (:line-width 1 :style released-button)
-          :background "grey75" :foreground "black"))
+  '((default
+     :box (:line-width 1 :style released-button)
+     :foreground "black")
+    (((type x w32 mac) (class color))
+     :background "grey75")
     (((type x) (class mono))
-     (:box (:line-width 1 :style released-button)
-          :background "grey" :foreground "black"))
-    (t
-     ()))
+     :background "grey"))
   "Basic tool-bar face."
   :version "21.1"
   :group 'basic-faces)
 
 
+(defface minibuffer-prompt '((((background dark)) :foreground "cyan")
+                            ;; Don't use blue because many users of
+                            ;; the MS-DOS port customize their
+                            ;; foreground color to be blue.
+                            (((type pc)) :foreground "magenta")
+                            (t :foreground "dark blue"))
+  "Face for minibuffer prompts."
+  :version "22.1"
+  :group 'basic-faces)
+
+(setq minibuffer-prompt-properties
+      (append minibuffer-prompt-properties (list 'face 'minibuffer-prompt)))
+
 (defface region
-  '((((type tty) (class color))
-     (:background "blue" :foreground "white"))
+  '((((class color) (min-colors 88) (background dark))
+     :background "blue3")
+    (((class color) (min-colors 88) (background light))
+     :background "lightgoldenrod2")
+    (((class color) (min-colors 16) (background dark))
+     :background "blue3")
+    (((class color) (min-colors 16) (background light))
+     :background "lightgoldenrod2")
+    (((class color) (min-colors 8))
+     :background "blue" :foreground "white")
     (((type tty) (class mono))
-     (:inverse-video t))
-    (((class color) (background dark))
-     (:background "blue3"))
-    (((class color) (background light))
-     (:background "lightgoldenrod2"))
-    (t (:background "gray")))
+     :inverse-video t)
+    (t :background "gray"))
   "Basic face for highlighting the region."
   :version "21.1"
   :group 'basic-faces)
@@ -1784,11 +1943,11 @@ created."
 
 (defface fringe
   '((((class color) (background light))
-       (:background "grey95"))
-      (((class color) (background dark))
-       (:background "grey10"))
-      (t
-       (:background "gray")))
+     :background "grey95")
+    (((class color) (background dark))
+     :background "grey10")
+    (t
+     :background "gray"))
   "Basic face for the fringes to the left and right of windows under X."
   :version "21.1"
   :group 'frames
@@ -1823,11 +1982,13 @@ created."
 
 
 (defface cursor '()
-  "Basic face for the cursor color under X."
+  "Basic face for the cursor color under X.
+Note: Other faces cannot inherit from the cursor face."
   :version "21.1"
   :group 'cursor
   :group 'basic-faces)
 
+(put 'cursor 'face-no-inherit t)
 
 (defface mouse '()
   "Basic face for the mouse color under X."
@@ -1836,72 +1997,95 @@ created."
   :group 'basic-faces)
 
 
-(defface bold '((t (:weight bold)))
+(defface bold '((t :weight bold))
   "Basic bold face."
   :group 'basic-faces)
 
 
-(defface italic '((t (:slant italic)))
+(defface italic
+  '((((supports :slant italic))
+     :slant italic)
+    (((supports :underline t))
+     :underline t)
+    (t
+     ;; default to italic, even it doesn't appear to be supported,
+     ;; because in some cases the display engine will do it's own
+     ;; workaround (to `dim' on ttys)
+     :slant italic))
   "Basic italic font."
   :group 'basic-faces)
 
 
-(defface bold-italic '((t (:weight bold :slant italic)))
+(defface bold-italic '((t :weight bold :slant italic))
   "Basic bold-italic face."
   :group 'basic-faces)
 
 
-(defface underline '((t (:underline t)))
+(defface underline '((t :underline t))
   "Basic underlined face."
   :group 'basic-faces)
 
 
 (defface highlight
-  '((((type tty) (class color))
-     (:background "green"))
-    (((class color) (background light))
-     (:background "darkseagreen2"))
-    (((class color) (background dark))
-     (:background "darkolivegreen"))
-    (t (:inverse-video t)))
+  '((((class color) (min-colors 88) (background light))
+     :background "darkseagreen2")
+    (((class color) (min-colors 88) (background dark))
+     :background "darkolivegreen")
+    (((class color) (min-colors 16) (background light))
+     :background "darkseagreen2")
+    (((class color) (min-colors 16) (background dark))
+     :background "darkolivegreen")
+    (((class color) (min-colors 8))
+     :background "green" :foreground "black")
+    (t :inverse-video t))
   "Basic face for highlighting."
   :group 'basic-faces)
 
 
 (defface secondary-selection
-  '((((type tty) (class color))
-     (:background "cyan" :foreground "black"))
-    (((class color) (background light))
-     (:background "yellow"))
-    (((class color) (background dark))
-     (:background "SkyBlue4"))
-    (t (:inverse-video t)))
+  '((((class color) (min-colors 88) (background light))
+     :background "yellow1")
+    (((class color) (min-colors 88) (background dark))
+     :background "SkyBlue4")
+    (((class color) (min-colors 16) (background light))
+     :background "yellow")
+    (((class color) (min-colors 16) (background dark))
+     :background "SkyBlue4")
+    (((class color) (min-colors 8))
+     :background "cyan" :foreground "black")
+    (t :inverse-video t))
   "Basic face for displaying the secondary selection."
   :group 'basic-faces)
 
 
-(defface fixed-pitch '((t (:family "courier")))
+(defface fixed-pitch '((t :family "courier"))
   "The basic fixed-pitch face."
   :group 'basic-faces)
 
 
-(defface variable-pitch '((t (:family "helv")))
+(defface variable-pitch '((t :family "helv"))
   "The basic variable-pitch face."
   :group 'basic-faces)
 
 
 (defface trailing-whitespace
   '((((class color) (background light))
-     (:background "red"))
+     :background "red1")
     (((class color) (background dark))
-     (:background "red"))
-    (t (:inverse-video t)))
+     :background "red1")
+    (t :inverse-video t))
   "Basic face for highlighting trailing whitespace."
   :version "21.1"
-  :group 'font-lock                    ; like `show-trailing-whitespace'
+  :group 'whitespace           ; like `show-trailing-whitespace'
   :group 'basic-faces)
 
-
+(defface escape-glyph '((((background dark)) :foreground "cyan")
+                       ;; See the comment in minibuffer-prompt for
+                       ;; the reason not to use blue on MS-DOS.
+                       (((type pc)) :foreground "magenta")
+                       (t :foreground "blue"))
+  "Face for characters displayed as ^-sequences or \-sequences."
+  :group 'basic-faces)
 \f
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;;; Manipulating font names.
@@ -2081,4 +2265,5 @@ If that can't be done, return nil."
 
 (provide 'faces)
 
+;;; arch-tag: 19a4759f-2963-445f-b004-425b9aadd7d6
 ;;; faces.el ends here