.
[bpt/emacs.git] / lisp / faces.el
index c719b0a..914f2c1 100644 (file)
@@ -55,7 +55,7 @@ a font height that isn't optimal."
           (set-default symbol value)
           (internal-set-font-selection-order value)))
 
-
+;; This is defined originally in {w32,x}faces.c.
 (defcustom face-font-family-alternatives
   '(("courier" "fixed")
     ("helv" "helvetica" "arial" "fixed"))
@@ -143,7 +143,7 @@ to NEW-FACE on frame NEW-FRAME."
 
 ;; The functions in this section are defined because Lisp packages use
 ;; them, despite the prefix `internal-' suggesting that they are
-;; private to the face implementation.  
+;; private to the face implementation.
 
 (defun internal-find-face (name &optional frame)
   "Retrieve the face named NAME.
@@ -156,6 +156,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."
   (facep name))
+(make-obsolete 'internal-find-face 'facep "21.1")
 
 
 (defun internal-get-face (name &optional frame)
@@ -169,7 +170,7 @@ This function is defined for compatibility with Emacs 20.2.  It
 should not be used anymore."
   (or (internal-find-face name frame)
       (check-face name)))
-
+(make-obsolete 'internal-get-face "See `facep' and `check-face'." "21.1")
 
 \f
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
@@ -512,7 +513,7 @@ box.
 `:inverse-video'
 
 VALUE specifies whether characters in FACE should be displayed in
-inverse video. VALUE must be one of t or nil.
+inverse video.  VALUE must be one of t or nil.
 
 `:stipple'
 
@@ -578,7 +579,8 @@ Use `set-face-attribute' for finer control of the font slant."
 
 (defun make-face-unitalic (face &optional frame noerror)
   "Make the font of FACE be non-italic, if possible.
-FRAME nil or not specified means change face on all frames."
+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 ")))
   (set-face-attribute face frame :slant 'normal))
 
@@ -624,7 +626,7 @@ When called interactively, prompt for the face and color."
 (defun set-face-stipple (face stipple &optional frame)
   "Change the stipple pixmap of face FACE to STIPPLE.
 FRAME nil or not specified means change face on all frames.
-STIPPLE. should be a string, the name of a file of pixmap data.
+STIPPLE should be a string, the name of a file of pixmap data.
 The directories listed in the `x-bitmap-file-path' variable are searched.
 
 Alternatively, STIPPLE may be a list of the form (WIDTH HEIGHT DATA)
@@ -897,8 +899,8 @@ of a global face.  Value is the new attribute value."
   "Read the name of a font for FACE on FRAME.
 If optional argument FRAME Is nil or omitted, use the selected frame."
   (let ((completion-ignore-case t))
-    (completing-read "Set font attributes of face %s from font: "
-                    face (x-list-fonts "*" nil frame))))
+    (completing-read (format "Set font attributes of face %s from font: " face)
+                    (mapcar 'list (x-list-fonts "*" nil frame)))))
 
 
 (defun read-all-face-attributes (face &optional frame)
@@ -985,14 +987,20 @@ The sample text is a string that comes from the variable
          (save-excursion
            (save-match-data
              (search-backward face-name)
-             (help-xref-button 0 #'customize-face face-name)))
+             (help-xref-button 0 (lambda (f)
+                                   (if help-xref-stack
+                                       (pop help-xref-stack))
+                                   (customize-face f))
+                               face-name
+                               "mouse-2: customize this face")))
          (let ((beg (point)))
            (insert list-faces-sample-text)
            ;; Hyperlink to a help buffer for the face.
            (save-excursion
              (save-match-data
                (search-backward list-faces-sample-text)
-               (help-xref-button 0 #'describe-face face)))
+               (help-xref-button 0 #'describe-face face
+                                 "mouse-2: describe this face")))
            (insert "\n")
            (put-text-property beg (1- (point)) 'face face)
            ;; If the sample text has multiple lines, line up all of them.
@@ -1021,7 +1029,7 @@ The sample text is a string that comes from the variable
 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")))
   (let* ((attrs '((:family . "Family")
                  (:width . "Width")
                  (:height . "Height")
@@ -1034,7 +1042,8 @@ If FRAME is omitted or nil, use the selected frame."
                  (:strike-through . "Strike-through")
                  (:box . "Box")
                  (:inverse-video . "Inverse")
-                 (:stipple . "Stipple")))
+                 (:stipple . "Stipple")
+                 (:font . "Font or fontset")))
        (max-width (apply #'max (mapcar #'(lambda (x) (length (cdr x)))
                                        attrs))))
     (with-output-to-temp-buffer "*Help*"
@@ -1046,11 +1055,21 @@ If FRAME is omitted or nil, use the selected frame."
                    (cdr a) ": " (format "%s" attr) "\n")))
        (insert "\nDocumentation:\n\n"
                (or (face-documentation face)
-                   "not documented as a face.")))
-      (print-help-return-message))))
-  
-
-
+                   "not documented as a face."))
+       (let ((customize-label "customize"))
+         (terpri)
+         (terpri)
+         (princ (concat "You can " customize-label " this face."))
+         (with-current-buffer "*Help*"
+           (save-excursion
+             (re-search-backward
+              (concat "\\(" customize-label "\\)") nil t)
+             (help-xref-button 1 #'customize-face face
+                               "mouse-2, RET: customize face")))))
+      (print-help-return-message)
+      (with-current-buffer "*Help*"
+       (help-setup-xref (list #'describe-face face) (interactive-p))
+       (buffer-string)))))
 \f
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;;; Face specifications (defface).
@@ -1104,7 +1123,7 @@ If FRAME is nil, the current FRAME is used."
                        ((eq req 'background)
                         (memq (frame-parameter frame 'background-mode)
                               options))
-                       (t (error "Unknown req `%S' with options `%S'" 
+                       (t (error "Unknown req `%S' with options `%S'"
                                  req options)))))
     match))
 
@@ -1256,7 +1275,7 @@ examine the brightness for you."
           (set var value)
           (mapcar 'frame-set-background-mode (frame-list)))
   :initialize 'custom-initialize-changed
-  :type '(choice (choice-item dark) 
+  :type '(choice (choice-item dark)
                 (choice-item light)
                 (choice-item :tag "default" nil)))
 
@@ -1452,14 +1471,14 @@ created."
 
 (defun frame-update-faces (frame)
   nil)
-
+(make-obsolete 'frame-update-faces "No longer necessary" "21.1")
 
 ;; Update the colors of FACE, after FRAME's own colors have been
 ;; changed.
 
 (defun frame-update-face-colors (frame)
   (frame-set-background-mode frame))
-
+(make-obsolete 'frame-update-face-colors 'frame-set-background-mode "21.1")
 
 \f
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
@@ -1652,9 +1671,8 @@ created."
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
 ;; This is here for compatibilty with Emacs 20.2.  For example,
-;; international/fontset.el uses these functions to manipulate font
-;; names.  The following functions are not used in the face
-;; implementation itself.
+;; international/fontset.el uses x-resolve-font-name.  The following
+;; functions are not used in the face implementation itself.
 
 (defvar x-font-regexp nil)
 (defvar x-font-regexp-head nil)
@@ -1701,12 +1719,12 @@ created."
                "\\([-*?]\\|\\'\\)"))
   (setq x-font-regexp-slant (concat - slant -))
   (setq x-font-regexp-weight (concat - weight -))
-  nil)     
+  nil)
 
 
 (defun x-resolve-font-name (pattern &optional face frame)
   "Return a font name matching PATTERN.
-All wildcards in PATTERN become substantiated.
+All wildcards in PATTERN are instantiated.
 If PATTERN is nil, return the name of the frame's base font, which never
 contains wildcards.
 Given optional arguments FACE and FRAME, return a font which is
@@ -1753,7 +1771,7 @@ also the same size as FACE on FRAME, or fail."
          ((string-match x-font-regexp-weight font)
           (concat (substring font 0 (match-beginning 1)) which
                   (substring font (match-end 1)))))))
-
+(make-obsolete 'x-frob-font-weight 'make-face-... "21.1")
 
 (defun x-frob-font-slant (font which)
   (let ((case-fold-search t))
@@ -1774,51 +1792,51 @@ also the same size as FACE on FRAME, or fail."
          ((string-match x-font-regexp-slant font)
           (concat (substring font 0 (match-beginning 1)) which
                   (substring font (match-end 1)))))))
-
+(make-obsolete 'x-frob-font-slant 'make-face-... "21.1")
 
 (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"))
-
+(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"))
-
+(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"))
-
+(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"))
-
+(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"))
-
+(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"))
-
+(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)))
-
+(make-obsolete 'x-make-font-bold-italic 'make-face-bold-italic "21.1")
 
 (provide 'faces)
 
-;;; end of faces.el
+;;; faces.el ends here