(toplevel): Provide `descr-text'.
[bpt/emacs.git] / lisp / faces.el
index 172efc5..ea391ae 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
 ;;   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.
@@ -66,7 +65,7 @@ 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."
@@ -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,7 +89,7 @@ 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."
@@ -200,7 +200,7 @@ 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."
-  (or (internal-find-face name frame)
+  (or (facep name)
       (check-face name)))
 (make-obsolete 'internal-get-face "See `facep' and `check-face'." "21.1")
 
@@ -302,7 +302,7 @@ If FRAME is omitted or nil, use the selected frame."
   "*List of X resources and classes for face attributes.
 Each element has the form (ATTRIBUTE ENTRY1 ENTRY2...) where ATTRIBUTE is
 the name of a face attribute, and each ENTRY is a cons of the form
-(RESOURCE . CLASS) with RESOURCE being the resource and CLASS being the
+\(RESOURCE . CLASS) with RESOURCE being the resource and CLASS being the
 X resource class for the attribute."
   :type '(repeat (cons symbol (repeat (cons string string))))
   :group 'faces)
@@ -355,45 +355,125 @@ FRAME nil or not specified means do it for all frames."
   (symbol-name (check-face face)))
 
 
-(defun face-attribute (face attribute &optional frame)
+(defun face-attribute (face attribute &optional frame inherit)
   "Return the value of FACE's ATTRIBUTE on 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."
-  (internal-get-lisp-face-attribute face attribute frame))
+If FRAME is omitted or nil, use the selected frame.
+
+If INHERIT is nil, only attributes directly defined by FACE are considered,
+  so the return value may be `unspecified', or a relative value.
+If INHERIT is non-nil, FACE's definition of ATTRIBUTE is merged with the
+  faces specified by its `:inherit' attribute; however the return value
+  may still be `unspecified' or relative.
+If INHERIT is a face or a list of faces, then the result is further merged
+  with that face (or faces), until it becomes specified and absolute.
+
+To ensure that the return value is always specified and absolute, use a
+value of `default' for INHERIT; this will resolve any unspecified or
+relative values by merging with the `default' face (which is always
+completely specified)."
+  (let ((value (internal-get-lisp-face-attribute face attribute frame)))
+    (when (and inherit (face-attribute-relative-p attribute value))
+      ;; 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)))))
+    (when (and inherit
+              (not (eq inherit t))
+              (face-attribute-relative-p attribute value))
+      ;; We should merge with INHERIT as well
+      (setq value (face-attribute-merged-with attribute value inherit frame)))
+    value))
 
+(defun face-attribute-merged-with (attribute value faces &optional frame)
+  "Merges ATTRIBUTE, initially VALUE, with faces from FACES until absolute.
+FACES may be either a single face or a list of faces.
+\[This is an internal function]"
+  (cond ((not (face-attribute-relative-p attribute value))
+        value)
+       ((null faces)
+        value)
+       ((consp faces)
+        (face-attribute-merged-with
+         attribute
+         (face-attribute-merged-with attribute value (car faces) frame)
+         (cdr faces)
+         frame))
+       (t
+        (merge-face-attribute attribute
+                              value
+                              (face-attribute faces attribute frame t)))))
+
+
+(defmacro face-attribute-specified-or (value &rest body)
+  "Return VALUE, unless it's `unspecified', in which case evaluate BODY and return the result."
+  (let ((temp (make-symbol "value")))
+    `(let ((,temp ,value))
+       (if (not (eq ,temp 'unspecified))
+          ,temp
+        ,@body))))
 
-(defun face-foreground (face &optional frame)
+(defun face-foreground (face &optional frame inherit)
   "Return the foreground color name of FACE, or nil if unspecified.
 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."
-  (let ((value (internal-get-lisp-face-attribute face :foreground frame)))
-    (if (eq value 'unspecified)
-       nil
-      value)))
-
+If FRAME is omitted or nil, use the selected frame.
 
-(defun face-background (face &optional frame)
+If INHERIT is nil, only a foreground color directly defined by FACE is
+  considered, so the return value may be nil.
+If INHERIT is t, and FACE doesn't define a foreground color, then any
+  foreground color that FACE inherits through its `:inherit' attribute
+  is considered as well; however the return value may still be nil.
+If INHERIT is a face or a list of faces, then it is used to try to
+  resolve an unspecified foreground color.
+
+To ensure that a valid color is always returned, use a value of
+`default' for INHERIT; this will resolve any unspecified values by
+merging with the `default' face (which is always completely specified)."
+  (face-attribute-specified-or (face-attribute face :foreground frame inherit)
+                              nil))
+
+(defun face-background (face &optional frame inherit)
   "Return the background color name of FACE, or nil if unspecified.
 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."
-  (let ((value (internal-get-lisp-face-attribute face :background frame)))
-    (if (eq value 'unspecified)
-       nil
-      value)))
-
+If FRAME is omitted or nil, use the selected frame.
 
-(defun face-stipple (face &optional frame)
+If INHERIT is nil, only a background color directly defined by FACE is
+  considered, so the return value may be nil.
+If INHERIT is t, and FACE doesn't define a background color, then any
+  background color that FACE inherits through its `:inherit' attribute
+  is considered as well; however the return value may still be nil.
+If INHERIT is a face or a list of faces, then it is used to try to
+  resolve an unspecified background color.
+
+To ensure that a valid color is always returned, use a value of
+`default' for INHERIT; this will resolve any unspecified values by
+merging with the `default' face (which is always completely specified)."
+  (face-attribute-specified-or (face-attribute face :background frame inherit)
+                              nil))
+
+(defun face-stipple (face &optional frame inherit)
  "Return the stipple pixmap name of FACE, or nil if unspecified.
 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."
-  (let ((value (internal-get-lisp-face-attribute face :stipple frame)))
-    (if (eq value 'unspecified)
-       nil
-      value)))
+If FRAME is omitted or nil, use the selected frame.
+
+If INHERIT is nil, only a stipple directly defined by FACE is
+  considered, so the return value may be nil.
+If INHERIT is t, and FACE doesn't define a stipple, then any stipple
+  that FACE inherits through its `:inherit' attribute is considered as
+  well; however the return value may still be nil.
+If INHERIT is a face or a list of faces, then it is used to try to
+  resolve an unspecified stipple.
+
+To ensure that a valid stipple or nil is always returned, use a value of
+`default' for INHERIT; this will resolve any unspecified values by merging
+with the `default' face (which is always completely specified)."
+  (face-attribute-specified-or (face-attribute face :stipple frame inherit)
+                              nil))
 
 
 (defalias 'face-background-pixmap 'face-stipple)
@@ -599,7 +679,7 @@ like an underlying face would be, with higher priority than underlying faces."
 FRAME nil or not specified means change face on all frames.
 Argument NOERROR is ignored and retained for compatibility.
 Use `set-face-attribute' for finer control of the font weight."
-  (interactive (list (read-face-name "Make which face bold ")))
+  (interactive (list (read-face-name "Make which face bold")))
   (set-face-attribute face frame :weight 'bold))
 
 
@@ -607,7 +687,7 @@ Use `set-face-attribute' for finer control of the font weight."
   "Make the font of FACE be non-bold, if possible.
 FRAME nil or not specified means change face on all frames.
 Argument NOERROR is ignored and retained for compatibility."
-  (interactive (list (read-face-name "Make which face non-bold ")))
+  (interactive (list (read-face-name "Make which face non-bold")))
   (set-face-attribute face frame :weight 'normal))
 
 
@@ -616,7 +696,7 @@ Argument NOERROR is ignored and retained for compatibility."
 FRAME nil or not specified means change face on all frames.
 Argument NOERROR is ignored and retained for compatibility.
 Use `set-face-attribute' for finer control of the font slant."
-  (interactive (list (read-face-name "Make which face italic ")))
+  (interactive (list (read-face-name "Make which face italic")))
   (set-face-attribute face frame :slant 'italic))
 
 
@@ -624,7 +704,7 @@ Use `set-face-attribute' for finer control of the font slant."
   "Make the font of FACE be non-italic, if possible.
 FRAME nil or not specified means change face on all frames.
 Argument NOERROR is ignored and retained for compatibility."
-  (interactive (list (read-face-name "Make which face non-italic ")))
+  (interactive (list (read-face-name "Make which face non-italic")))
   (set-face-attribute face frame :slant 'normal))
 
 
@@ -633,7 +713,7 @@ Argument NOERROR is ignored and retained for compatibility."
 FRAME nil or not specified means change face on all frames.
 Argument NOERROR is ignored and retained for compatibility.
 Use `set-face-attribute' for finer control of font weight and slant."
-  (interactive (list (read-face-name "Make which face bold-italic")))
+  (interactive (list (read-face-name "Make which face bold-italic")))
   (set-face-attribute face frame :weight 'bold :slant 'italic))
 
 
@@ -744,14 +824,14 @@ Use `set-face-attribute' or `modify-face' for finer control."
 
 (defun invert-face (face &optional frame)
   "Swap the foreground and background colors of FACE.
-FRAME nil or not specified means change face on all frames.
+If FRAME is omitted or nil, it means change face on all frames.
 If FACE specifies neither foreground nor background color,
 set its foreground and background to the background and foreground
 of the default face.  Value is FACE."
-  (interactive (list (read-face-name "Invert face ")))
+  (interactive (list (read-face-name "Invert face")))
   (let ((fg (face-attribute face :foreground frame))
        (bg (face-attribute face :background frame)))
-    (if (or fg bg)
+    (if (not (and (eq fg 'unspecified) (eq bg 'unspecified)))
        (set-face-attribute face frame :foreground bg :background fg)
       (set-face-attribute face frame
                          :foreground
@@ -765,20 +845,54 @@ of the default face.  Value is FACE."
 ;;; Interactively modifying faces.
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
-(defun read-face-name (prompt)
-  "Read and return a face symbol, prompting with PROMPT.
-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 (listp faceprop)
+       (dolist (f faceprop)
+         (if (symbolp f)
+             (push f faces)))
+      (if (symbolp faceprop)
+         (setq faces (list faceprop))))
+    ;; 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)
@@ -1043,7 +1157,7 @@ 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))
@@ -1055,8 +1169,9 @@ 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)))
+             (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
@@ -1065,6 +1180,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)
@@ -1085,13 +1203,15 @@ The sample text is a string that comes from the variable
            (copy-face (car faces) (car faces) frame disp-frame)
            (setq faces (cdr faces)))))))
 
-
 (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")
@@ -1109,28 +1229,35 @@ If FRAME is omitted or nil, use the selected frame."
                  (:inherit . "Inherit")))
        (max-width (apply #'max (mapcar #'(lambda (x) (length (cdr x)))
                                        attrs))))
-    (require 'help-mode)
+    (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)))))
-      (print-help-return-message)
-      (help-setup-xref (list #'describe-face face) (interactive-p)))))
+       (dolist (f face)
+         (insert "Face: " (symbol-name f))
+         (if (not (facep f))
+             (insert "   undefined face.\n")
+           (let ((customize-label "customize this face"))
+             (princ (concat " (" customize-label ")\n"))
+             (insert "Documentation: "
+                     (or (face-documentation f)
+                         "not documented as a face.")
+                     "\n\n")
+             (with-current-buffer standard-output
+               (save-excursion
+                 (re-search-backward
+                  (concat "\\(" customize-label "\\)") nil t)
+                 (help-xref-button 1 'help-customize-face f)))
+             (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
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
@@ -1202,19 +1329,21 @@ If SPEC is nil, return nil."
   (unless frame
     (setq frame (selected-frame)))
   (let ((tail spec)
-       result)
+       result all)
     (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))
+         (setq result (if (null (cdr attrs)) ;; was (listp (car attrs))
                           ;; Old-style entry, the attribute list is the
                           ;; first element.
                           (car attrs)
-                        attrs)
-               tail nil))))
-    result))
+                        attrs))
+         (if (eq display t)
+             (setq all result result nil)
+           (setq tail nil)))))
+    (if all (append result all) result)))
 
 
 (defun face-spec-reset-face (face &optional frame)
@@ -1515,12 +1644,13 @@ Value is the new frame created."
   "Set frame-local faces of FRAME from face specs and resources.
 Initialize colors of certain faces from frame parameters."
   (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)))
+    (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))))
 
   ;; Initialize attributes from frame parameters.
   (let ((params '((foreground-color default :foreground)
@@ -1622,20 +1752,39 @@ created."
 
 (defface mode-line
   '((((type x w32 mac) (class color))
-     (:box (:line-width -1 :style released-button)
-          :background "grey75" :foreground "black"))
+     :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
+  '((t
+     :inherit mode-line)
+    (((type x w32 mac) (background light) (class color))
+     :weight light
+     :box (:line-width -1 :color "grey75" :style nil)
+     :foreground "grey20" :background "grey90")
+    (((type x w32 mac) (background dark) (class color))
+     :weight light
+     :box (:line-width -1 :color "grey40" :style nil)
+     :foreground "grey80" :background "grey30"))
+  "Basic mode line face for non-selected windows."
+  :version "21.4"
+  :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)
 
 (defface header-line
-  '((((type tty))
+  '((t
+     :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
@@ -1647,27 +1796,21 @@ created."
      ;; the info browser. XXX
      :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)
@@ -1675,11 +1818,11 @@ created."
 
 (defface tool-bar
   '((((type x w32 mac) (class color))
-     (:box (:line-width 1 :style released-button)
-          :background "grey75" :foreground "black"))
+     :box (:line-width 1 :style released-button)
+     :background "grey75" :foreground "black")
     (((type x) (class mono))
-     (:box (:line-width 1 :style released-button)
-          :background "grey" :foreground "black"))
+     :box (:line-width 1 :style released-button)
+     :background "grey" :foreground "black")
     (t
      ()))
   "Basic tool-bar face."
@@ -1687,16 +1830,26 @@ created."
   :group 'basic-faces)
 
 
+(defface minibuffer-prompt '((((background dark)) :foreground "cyan")
+                            (((type pc)) :foreground "magenta")
+                            (t :foreground "dark blue"))
+  "Face for minibuffer prompts."
+  :version "21.4"
+  :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"))
+     :background "blue" :foreground "white")
     (((type tty) (class mono))
-     (:inverse-video t))
+     :inverse-video t)
     (((class color) (background dark))
-     (:background "blue3"))
+     :background "blue3")
     (((class color) (background light))
-     (:background "lightgoldenrod2"))
-    (t (:background "gray")))
+     :background "lightgoldenrod2")
+    (t :background "gray"))
   "Basic face for highlighting the region."
   :version "21.1"
   :group 'basic-faces)
@@ -1704,11 +1857,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
@@ -1756,66 +1909,66 @@ 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 '((t :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"))
+     :background "green" :foreground "black")
     (((class color) (background light))
-     (:background "darkseagreen2"))
+     :background "darkseagreen2")
     (((class color) (background dark))
-     (:background "darkolivegreen"))
-    (t (:inverse-video t)))
+     :background "darkolivegreen")
+    (t :inverse-video t))
   "Basic face for highlighting."
   :group 'basic-faces)
 
 
 (defface secondary-selection
   '((((type tty) (class color))
-     (:background "cyan" :foreground "black"))
+     :background "cyan" :foreground "black")
     (((class color) (background light))
-     (:background "yellow"))
+     :background "yellow")
     (((class color) (background dark))
-     (:background "SkyBlue4"))
-    (t (:inverse-video t)))
+     :background "SkyBlue4")
+    (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 "red")
     (((class color) (background dark))
-     (:background "red"))
-    (t (:inverse-video t)))
+     :background "red")
+    (t :inverse-video t))
   "Basic face for highlighting trailing whitespace."
   :version "21.1"
   :group 'font-lock                    ; like `show-trailing-whitespace'
@@ -1951,47 +2104,52 @@ also the same size as FACE on FRAME, or fail."
                   (substring font (match-end 1)))))))
 (make-obsolete 'x-frob-font-slant 'make-face-... "21.1")
 
+;; These aliases are here so that we don't get warnings about obsolete
+;; functions from the byte compiler.
+(defalias 'internal-frob-font-weight 'x-frob-font-weight)
+(defalias 'internal-frob-font-slant 'x-frob-font-slant)
+
 (defun x-make-font-bold (font)
   "Given an X font specification, make a bold version of it.
 If that can't be done, return nil."
-  (x-frob-font-weight font "bold"))
+  (internal-frob-font-weight font "bold"))
 (make-obsolete 'x-make-font-bold 'make-face-bold "21.1")
 
 (defun x-make-font-demibold (font)
   "Given an X font specification, make a demibold version of it.
 If that can't be done, return nil."
-  (x-frob-font-weight font "demibold"))
+  (internal-frob-font-weight font "demibold"))
 (make-obsolete 'x-make-font-demibold 'make-face-bold "21.1")
 
 (defun x-make-font-unbold (font)
   "Given an X font specification, make a non-bold version of it.
 If that can't be done, return nil."
-  (x-frob-font-weight font "medium"))
+  (internal-frob-font-weight font "medium"))
 (make-obsolete 'x-make-font-unbold 'make-face-unbold "21.1")
 
 (defun x-make-font-italic (font)
   "Given an X font specification, make an italic version of it.
 If that can't be done, return nil."
-  (x-frob-font-slant font "i"))
+  (internal-frob-font-slant font "i"))
 (make-obsolete 'x-make-font-italic 'make-face-italic "21.1")
 
 (defun x-make-font-oblique (font) ; you say tomayto...
   "Given an X font specification, make an oblique version of it.
 If that can't be done, return nil."
-  (x-frob-font-slant font "o"))
+  (internal-frob-font-slant font "o"))
 (make-obsolete 'x-make-font-oblique 'make-face-italic "21.1")
 
 (defun x-make-font-unitalic (font)
   "Given an X font specification, make a non-italic version of it.
 If that can't be done, return nil."
-  (x-frob-font-slant font "r"))
+  (internal-frob-font-slant font "r"))
 (make-obsolete 'x-make-font-unitalic 'make-face-unitalic "21.1")
 
 (defun x-make-font-bold-italic (font)
   "Given an X font specification, make a bold and italic version of it.
 If that can't be done, return nil."
-  (and (setq font (x-make-font-bold font))
-       (x-make-font-italic font)))
+  (and (setq font (internal-frob-font-weight font "bold"))
+       (internal-frob-font-slant font "i")))
 (make-obsolete 'x-make-font-bold-italic 'make-face-bold-italic "21.1")
 
 (provide 'faces)