import -ko -b 1.1.3 XEmacs XEmacs-21_2 r21-2-35
[chise/xemacs-chise.git.1] / lisp / faces.el
index 265ce26..156de24 100644 (file)
@@ -292,41 +292,41 @@ If PROPERTY is not a built-in property, then this function will
 The following symbols have predefined meanings:
 
  foreground         The foreground color of the face.
-                    For valid instantiators, see `color-specifier-p'.
+                    For valid instantiators, see `make-color-specifier'.
 
  background         The background color of the face.
-                    For valid instantiators, see `color-specifier-p'.
+                    For valid instantiators, see `make-color-specifier'.
 
  font               The font used to display text covered by this face.
-                    For valid instantiators, see `font-specifier-p'.
+                    For valid instantiators, see `make-font-specifier'.
 
  display-table      The display table of the face.
                     This should be a vector of 256 elements.
 
  background-pixmap  The pixmap displayed in the background of the face.
                     Only used by faces on X devices.
-                    For valid instantiators, see `image-specifier-p'.
+                    For valid instantiators, see `make-image-specifier'.
 
  underline          Underline all text covered by this face.
-                    For valid instantiators, see `face-boolean-specifier-p'.
+                    For valid instantiators, see `make-face-boolean-specifier'.
 
  strikethru         Draw a line through all text covered by this face.
-                    For valid instantiators, see `face-boolean-specifier-p'.
+                    For valid instantiators, see `make-face-boolean-specifier'.
 
  highlight          Highlight all text covered by this face.
                     Only used by faces on TTY devices.
-                    For valid instantiators, see `face-boolean-specifier-p'.
+                    For valid instantiators, see `make-face-boolean-specifier'.
 
  dim                Dim all text covered by this face.
-                    For valid instantiators, see `face-boolean-specifier-p'.
+                    For valid instantiators, see `make-face-boolean-specifier'.
 
  blinking           Blink all text covered by this face.
                     Only used by faces on TTY devices.
-                    For valid instantiators, see `face-boolean-specifier-p'.
+                    For valid instantiators, see `make-face-boolean-specifier'.
 
  reverse            Reverse the foreground and background colors.
                     Only used by faces on TTY devices.
-                    For valid instantiators, see `face-boolean-specifier-p'.
+                    For valid instantiators, see `make-face-boolean-specifier'.
 
  doc-string         Description of what the face's normal use is.
                     NOTE: This is not a specifier, unlike all
@@ -433,7 +433,7 @@ See `face-property-instance' for more information."
 
 FACE may be either a face object or a symbol representing a face.
 
-FONT should be an instantiator (see `font-specifier-p'), a list of
+FONT should be an instantiator (see `make-font-specifier'), a list of
   instantiators, an alist of specifications (each mapping a
   locale to an instantiator list), or a font specifier object.
 
@@ -490,7 +490,7 @@ See `face-property-instance' for more information."
 
 FACE may be either a face object or a symbol representing a face.
 
-COLOR should be an instantiator (see `color-specifier-p'), a list of
+COLOR should be an instantiator (see `make-color-specifier'), a list of
   instantiators, an alist of specifications (each mapping a locale to
   an instantiator list), or a color specifier object.
 
@@ -547,7 +547,7 @@ See `face-property-instance' for more information."
 
 FACE may be either a face object or a symbol representing a face.
 
-COLOR should be an instantiator (see `color-specifier-p'), a list of
+COLOR should be an instantiator (see `make-color-specifier'), a list of
   instantiators, an alist of specifications (each mapping a locale to
   an instantiator list), or a color specifier object.
 
@@ -595,7 +595,7 @@ This property is only used on window system devices.
 
 FACE may be either a face object or a symbol representing a face.
 
-PIXMAP should be an instantiator (see `image-specifier-p'), a list
+PIXMAP should be an instantiator (see `make-image-specifier'), a list
   of instantiators, an alist of specifications (each mapping a locale
   to an instantiator list), or an image specifier object.
 
@@ -652,7 +652,7 @@ See `face-property-instance' for the semantics of the DOMAIN argument."
                                  how-to-add)
   "Change the underline property of FACE to UNDERLINE-P.
 UNDERLINE-P is normally a face-boolean instantiator; see
- `face-boolean-specifier-p'.
+ `make-face-boolean-specifier'.
 See `set-face-property' for the semantics of the LOCALE, TAG-SET, and
  HOW-TO-ADD arguments."
   (interactive (face-interactive "underline-p" "underlined"))
@@ -667,7 +667,7 @@ See `face-property-instance' for the semantics of the DOMAIN argument."
                                  how-to-add)
   "Change whether FACE is strikethru-d (i.e. struck through) in LOCALE.
 STRIKETHRU-P is normally a face-boolean instantiator; see
- `face-boolean-specifier-p'.
+ `make-face-boolean-specifier'.
 See `set-face-property' for the semantics of the LOCALE, TAG-SET, and
  HOW-TO-ADD arguments."
   (interactive (face-interactive "strikethru-p" "strikethru-d"))
@@ -682,7 +682,7 @@ See `face-property-instance' for the semantics of the DOMAIN argument."
                                  how-to-add)
   "Change whether FACE is highlighted in LOCALE (TTY locales only).
 HIGHLIGHT-P is normally a face-boolean instantiator; see
- `face-boolean-specifier-p'.
+ `make-face-boolean-specifier'.
 See `set-face-property' for the semantics of the LOCALE, TAG-SET, and
  HOW-TO-ADD arguments."
   (interactive (face-interactive "highlight-p" "highlighted"))
@@ -696,7 +696,7 @@ See `face-property-instance' for the semantics of the DOMAIN argument."
 (defun set-face-dim-p (face dim-p &optional locale tag-set how-to-add)
   "Change whether FACE is dimmed in LOCALE.
 DIM-P is normally a face-boolean instantiator; see
- `face-boolean-specifier-p'.
+ `make-face-boolean-specifier'.
 See `set-face-property' for the semantics of the LOCALE, TAG-SET, and
  HOW-TO-ADD arguments."
   (interactive (face-interactive "dim-p" "dimmed"))
@@ -711,7 +711,7 @@ See `face-property-instance' for the semantics of the DOMAIN argument."
                                 how-to-add)
   "Change whether FACE is blinking in LOCALE (TTY locales only).
 BLINKING-P is normally a face-boolean instantiator; see
- `face-boolean-specifier-p'.
+ `make-face-boolean-specifier'.
 See `set-face-property' for the semantics of the LOCALE, TAG-SET, and
  HOW-TO-ADD arguments."
   (interactive (face-interactive "blinking-p" "blinking"))
@@ -725,7 +725,7 @@ See `face-property-instance' for the semantics of the DOMAIN argument."
 (defun set-face-reverse-p (face reverse-p &optional locale tag-set how-to-add)
   "Change whether FACE is reversed in LOCALE (TTY locales only).
 REVERSE-P is normally a face-boolean instantiator; see
- `face-boolean-specifier-p'.
+ `make-face-boolean-specifier'.
 See `set-face-property' for the semantics of the LOCALE, TAG-SET, and
  HOW-TO-ADD arguments."
   (interactive (face-interactive "reverse-p" "reversed"))
@@ -1360,6 +1360,24 @@ If FRAME is nil or omitted, initialize them for all frames."
                 (get-custom-frame-properties frame))
     (initialize-custom-faces frame)))
 
+(defun startup-initialize-custom-faces ()
+  "Reset faces created by defface.  Only called at startup.
+Don't use this function in your program."
+  (when default-custom-frame-properties
+    ;; Reset default value to the actual frame, not stream.
+    (setq default-custom-frame-properties
+         (extract-custom-frame-properties (selected-frame)))
+    ;; like initialize-custom-faces but removes property first.
+    (mapc (lambda (symbol)
+           (let ((spec (or (get symbol 'saved-face)
+                           (get symbol 'face-defface-spec))))
+             (when spec
+               ;; Reset faces created during auto-autoloads loading.
+               (reset-face symbol)
+               ;; And set it according to the spec.
+               (face-display-set symbol spec nil))))
+         (face-list))))
+
 \f
 (defun make-empty-face (name &optional doc-string temporary)
   "Like `make-face', but doesn't query the resource database."
@@ -1521,7 +1539,7 @@ you want to add code to do stuff like this, use the create-device-hook."
   ;; It's unreasonable to expect to be able to make a font italic all
   ;; the time.  For many languages, italic is an alien concept.
   ;; Basically, because italic is not a globally meaningful concept,
-  ;; the use of the italic face should really be oboleted.
+  ;; the use of the italic face should really be obsoleted.
 
   ;; I disagree with above.  In many languages, the concept of capital
   ;; letters is just as alien, and yet we use them.  Italic is here to
@@ -1571,14 +1589,17 @@ you want to add code to do stuff like this, use the create-device-hook."
                         nil 'append))
   )
 
-;; New function with 20.1, suggested by Per Abrahamsen, coded by Kyle Jones.
+;; New function with 20.1, suggested by Per Abrahamsen, coded by Kyle
+;; Jones and Hrvoje Niksic.
 (defun set-face-stipple (face pixmap &optional frame)
   "Change the stipple pixmap of FACE to PIXMAP.
 This is an Emacs compatibility function; consider using
 set-face-background-pixmap instead.
 
 PIXMAP should be a string, the name of a file of pixmap data.
-The directories listed in the `x-bitmap-file-path' variable are searched.
+The directories listed in the variables `x-bitmap-file-path' and
+`mswindows-bitmap-file-path' under X and MS Windows respectively
+are searched.
 
 Alternatively, PIXMAP may be a list of the form (WIDTH HEIGHT
 DATA) where WIDTH and HEIGHT are the size in pixels, and DATA is
@@ -1589,20 +1610,33 @@ If the optional FRAME argument is provided, change only
 in that frame; otherwise change each frame."
   (while (not (find-face face))
     (setq face (signal 'wrong-type-argument (list 'facep face))))
-  (locate-file pixmap x-bitmap-file-path '(".xbm" ""))
-  (while (cond ((stringp pixmap)
-               (unless (file-readable-p pixmap)
-                 (setq pixmap `[xbm :file ,pixmap]))
-               nil)
-              ((and (consp pixmap) (= (length pixmap) 3))
-               (setq pixmap `[xbm :data ,pixmap])
-               nil)
-              (t t))
-    (setq pixmap (signal 'wrong-type-argument
-                        (list 'stipple-pixmap-p pixmap))))
-  (while (and frame (not (framep frame)))
-    (setq frame (signal 'wrong-type-argument (list 'framep frame))))
-  (set-face-background-pixmap face pixmap frame))
+  (let ((bitmap-path (ecase (console-type)
+                      (x         x-bitmap-file-path)
+                      (mswindows mswindows-bitmap-file-path)))
+       instantiator)
+    (while
+       (null
+        (setq instantiator
+              (cond ((stringp pixmap)
+                     (let ((file (if (file-name-absolute-p pixmap)
+                                     pixmap
+                                   (locate-file pixmap bitmap-path
+                                                '(".xbm" "")))))
+                       (and file
+                            `[xbm :file ,file])))
+                    ((and (listp pixmap) (= (length pixmap) 3))
+                     `[xbm :data ,pixmap])
+                    (t nil))))
+      ;; We're signaling a continuable error; let's make sure the
+      ;; function `stipple-pixmap-p' at least exists.
+      (flet ((stipple-pixmap-p (pixmap)
+              (or (stringp pixmap)
+                  (and (listp pixmap) (= (length pixmap) 3)))))
+       (setq pixmap (signal 'wrong-type-argument
+                            (list 'stipple-pixmap-p pixmap)))))
+    (while (and frame (not (framep frame)))
+      (setq frame (signal 'wrong-type-argument (list 'framep frame))))
+    (set-face-background-pixmap face instantiator frame)))
 
 \f
 ;; Create the remaining standard faces now.  This way, packages that we dump
@@ -1727,7 +1761,8 @@ in that frame; otherwise change each frame."
                        (and 
                         (featurep 'x)
                         (x-get-resource "backgroundToolBarColor"
-                                        "BackgroundToolBarColor" 'string))
+                                        "BackgroundToolBarColor" 'string
+                                        nil nil 'warn))
 
                        (face-background 'toolbar))))
           (purecopy '("foregroundToolBarColor"
@@ -1735,7 +1770,8 @@ in that frame; otherwise change each frame."
                        (and 
                         (featurep 'x)
                         (x-get-resource "foregroundToolBarColor"
-                                        "ForegroundToolBarColor" 'string))
+                                        "ForegroundToolBarColor" 'string
+                                        nil nil 'warn))
                        (face-foreground 'toolbar))))
           )))