* font-lock.el: Don't deal with font-lock-face-attributes here,
authorDan Nicolaescu <dann@ics.uci.edu>
Sat, 5 Nov 2005 07:29:45 +0000 (07:29 +0000)
committerDan Nicolaescu <dann@ics.uci.edu>
Sat, 5 Nov 2005 07:29:45 +0000 (07:29 +0000)
move the code ...

* startup.el (command-line): ... here. Use face-spec-set instead
of custom-declare-face.

* faces.el (face-spec-set): Reset the face if spec is not nil.

lisp/ChangeLog
lisp/faces.el
lisp/font-lock.el
lisp/startup.el

index db34296..5399ac6 100644 (file)
@@ -1,3 +1,13 @@
+2005-11-04  Dan Nicolaescu  <dann@ics.uci.edu>
+
+       * font-lock.el: Don't deal with font-lock-face-attributes here,
+       move the code ...
+
+       * startup.el (command-line): ... here. Use face-spec-set instead
+       of custom-declare-face.
+
+       * faces.el (face-spec-set): Reset the face if spec is not nil.
+
 2005-11-04  Stefan Monnier  <monnier@iro.umontreal.ca>
 
        * newcomment.el (comment-region-internal): Box more tightly in the
index 8ca9e40..bcbda67 100644 (file)
@@ -1448,7 +1448,7 @@ FRAME is the frame whose frame-local face is set.  FRAME nil means
 do it on all frames.  See `defface' for information about SPEC.
 If SPEC is nil, do nothing."
   (let ((attrs (face-spec-choose spec frame)))
-    (when attrs
+    (when spec
       (face-spec-reset-face face frame))
     (while attrs
       (let ((attribute (car attrs))
index a55eb96..398b7fe 100644 (file)
@@ -1646,37 +1646,8 @@ Sets various variables using `font-lock-defaults' (or, if nil, using
 \f
 ;;; Colour etc. support.
 
-;; Originally face attributes were specified via `font-lock-face-attributes'.
-;; Users then changed the default face attributes by setting that variable.
-;; However, we try and be back-compatible and respect its value if set except
-;; for faces where M-x customize has been used to save changes for the face.
-(when (boundp 'font-lock-face-attributes)
-  (let ((face-attributes font-lock-face-attributes))
-    (while face-attributes
-      (let* ((face-attribute (pop face-attributes))
-            (face (car face-attribute)))
-       ;; Rustle up a `defface' SPEC from a `font-lock-face-attributes' entry.
-       (unless (get face 'saved-face)
-         (let ((foreground (nth 1 face-attribute))
-               (background (nth 2 face-attribute))
-               (bold-p (nth 3 face-attribute))
-               (italic-p (nth 4 face-attribute))
-               (underline-p (nth 5 face-attribute))
-               face-spec)
-           (when foreground
-             (setq face-spec (cons ':foreground (cons foreground face-spec))))
-           (when background
-             (setq face-spec (cons ':background (cons background face-spec))))
-           (when bold-p
-             (setq face-spec (append '(:weight bold) face-spec)))
-           (when italic-p
-             (setq face-spec (append '(:slant italic) face-spec)))
-           (when underline-p
-             (setq face-spec (append '(:underline t) face-spec)))
-           (custom-declare-face face (list (list t face-spec)) nil)))))))
-
-;; But now we do it the custom way.  Note that `defface' will not overwrite any
-;; faces declared above via `custom-declare-face'.
+;; Note that `defface' will not overwrite any faces declared above via
+;; `custom-declare-face'.
 (defface font-lock-comment-face
   '((((class grayscale) (background light))
      (:foreground "DimGray" :weight bold :slant italic))
index 5e13543..8dae910 100644 (file)
@@ -958,6 +958,38 @@ or `CVS', and any subdirectory that contains a file named `.nosearch'."
                                        (or mail-host-address
                                            (system-name)))))
 
+    ;; Originally face attributes were specified via
+    ;; `font-lock-face-attributes'.  Users then changed the default
+    ;; face attributes by setting that variable.  However, we try and
+    ;; be back-compatible and respect its value if set except for
+    ;; faces where M-x customize has been used to save changes for the
+    ;; face.
+    (when (boundp 'font-lock-face-attributes)
+      (let ((face-attributes font-lock-face-attributes))
+       (while face-attributes
+         (let* ((face-attribute (pop face-attributes))
+                (face (car face-attribute)))
+           ;; Rustle up a `defface' SPEC from a
+           ;; `font-lock-face-attributes' entry.
+           (unless (get face 'saved-face)
+             (let ((foreground (nth 1 face-attribute))
+                   (background (nth 2 face-attribute))
+                   (bold-p (nth 3 face-attribute))
+                   (italic-p (nth 4 face-attribute))
+                   (underline-p (nth 5 face-attribute))
+                   face-spec)
+               (when foreground
+                 (setq face-spec (cons ':foreground (cons foreground face-spec))))
+               (when background
+                 (setq face-spec (cons ':background (cons background face-spec))))
+               (when bold-p
+                 (setq face-spec (append '(:weight bold) face-spec)))
+               (when italic-p
+                 (setq face-spec (append '(:slant italic) face-spec)))
+               (when underline-p
+                 (setq face-spec (append '(:underline t) face-spec)))
+               (face-spec-set face (list (list t face-spec)) nil)))))))
+
     ;; If parameter have been changed in the init file which influence
     ;; face realization, clear the face cache so that new faces will
     ;; be realized.