diff options
| author | Dan Nicolaescu | 2005-11-05 07:29:45 +0000 |
|---|---|---|
| committer | Dan Nicolaescu | 2005-11-05 07:29:45 +0000 |
| commit | d60b49ac4e4ef6cbb9752b21284407f352d2bd9e (patch) | |
| tree | 66a3d8e66bae82ef8bd14f13b2d7c861b825a5eb | |
| parent | 6b19bd8250c2975fbf95c90950a1003defb39e55 (diff) | |
| download | emacs-d60b49ac4e4ef6cbb9752b21284407f352d2bd9e.tar.gz emacs-d60b49ac4e4ef6cbb9752b21284407f352d2bd9e.zip | |
* 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.
| -rw-r--r-- | lisp/ChangeLog | 10 | ||||
| -rw-r--r-- | lisp/faces.el | 2 | ||||
| -rw-r--r-- | lisp/font-lock.el | 33 | ||||
| -rw-r--r-- | lisp/startup.el | 32 |
4 files changed, 45 insertions, 32 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index db34296326f..5399ac62357 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,13 @@ | |||
| 1 | 2005-11-04 Dan Nicolaescu <dann@ics.uci.edu> | ||
| 2 | |||
| 3 | * font-lock.el: Don't deal with font-lock-face-attributes here, | ||
| 4 | move the code ... | ||
| 5 | |||
| 6 | * startup.el (command-line): ... here. Use face-spec-set instead | ||
| 7 | of custom-declare-face. | ||
| 8 | |||
| 9 | * faces.el (face-spec-set): Reset the face if spec is not nil. | ||
| 10 | |||
| 1 | 2005-11-04 Stefan Monnier <monnier@iro.umontreal.ca> | 11 | 2005-11-04 Stefan Monnier <monnier@iro.umontreal.ca> |
| 2 | 12 | ||
| 3 | * newcomment.el (comment-region-internal): Box more tightly in the | 13 | * newcomment.el (comment-region-internal): Box more tightly in the |
diff --git a/lisp/faces.el b/lisp/faces.el index 8ca9e40d7d2..bcbda67b87b 100644 --- a/lisp/faces.el +++ b/lisp/faces.el | |||
| @@ -1448,7 +1448,7 @@ FRAME is the frame whose frame-local face is set. FRAME nil means | |||
| 1448 | do it on all frames. See `defface' for information about SPEC. | 1448 | do it on all frames. See `defface' for information about SPEC. |
| 1449 | If SPEC is nil, do nothing." | 1449 | If SPEC is nil, do nothing." |
| 1450 | (let ((attrs (face-spec-choose spec frame))) | 1450 | (let ((attrs (face-spec-choose spec frame))) |
| 1451 | (when attrs | 1451 | (when spec |
| 1452 | (face-spec-reset-face face frame)) | 1452 | (face-spec-reset-face face frame)) |
| 1453 | (while attrs | 1453 | (while attrs |
| 1454 | (let ((attribute (car attrs)) | 1454 | (let ((attribute (car attrs)) |
diff --git a/lisp/font-lock.el b/lisp/font-lock.el index a55eb96ec0d..398b7fef064 100644 --- a/lisp/font-lock.el +++ b/lisp/font-lock.el | |||
| @@ -1646,37 +1646,8 @@ Sets various variables using `font-lock-defaults' (or, if nil, using | |||
| 1646 | 1646 | ||
| 1647 | ;;; Colour etc. support. | 1647 | ;;; Colour etc. support. |
| 1648 | 1648 | ||
| 1649 | ;; Originally face attributes were specified via `font-lock-face-attributes'. | 1649 | ;; Note that `defface' will not overwrite any faces declared above via |
| 1650 | ;; Users then changed the default face attributes by setting that variable. | 1650 | ;; `custom-declare-face'. |
| 1651 | ;; However, we try and be back-compatible and respect its value if set except | ||
| 1652 | ;; for faces where M-x customize has been used to save changes for the face. | ||
| 1653 | (when (boundp 'font-lock-face-attributes) | ||
| 1654 | (let ((face-attributes font-lock-face-attributes)) | ||
| 1655 | (while face-attributes | ||
| 1656 | (let* ((face-attribute (pop face-attributes)) | ||
| 1657 | (face (car face-attribute))) | ||
| 1658 | ;; Rustle up a `defface' SPEC from a `font-lock-face-attributes' entry. | ||
| 1659 | (unless (get face 'saved-face) | ||
| 1660 | (let ((foreground (nth 1 face-attribute)) | ||
| 1661 | (background (nth 2 face-attribute)) | ||
| 1662 | (bold-p (nth 3 face-attribute)) | ||
| 1663 | (italic-p (nth 4 face-attribute)) | ||
| 1664 | (underline-p (nth 5 face-attribute)) | ||
| 1665 | face-spec) | ||
| 1666 | (when foreground | ||
| 1667 | (setq face-spec (cons ':foreground (cons foreground face-spec)))) | ||
| 1668 | (when background | ||
| 1669 | (setq face-spec (cons ':background (cons background face-spec)))) | ||
| 1670 | (when bold-p | ||
| 1671 | (setq face-spec (append '(:weight bold) face-spec))) | ||
| 1672 | (when italic-p | ||
| 1673 | (setq face-spec (append '(:slant italic) face-spec))) | ||
| 1674 | (when underline-p | ||
| 1675 | (setq face-spec (append '(:underline t) face-spec))) | ||
| 1676 | (custom-declare-face face (list (list t face-spec)) nil))))))) | ||
| 1677 | |||
| 1678 | ;; But now we do it the custom way. Note that `defface' will not overwrite any | ||
| 1679 | ;; faces declared above via `custom-declare-face'. | ||
| 1680 | (defface font-lock-comment-face | 1651 | (defface font-lock-comment-face |
| 1681 | '((((class grayscale) (background light)) | 1652 | '((((class grayscale) (background light)) |
| 1682 | (:foreground "DimGray" :weight bold :slant italic)) | 1653 | (:foreground "DimGray" :weight bold :slant italic)) |
diff --git a/lisp/startup.el b/lisp/startup.el index 5e135433a26..8dae9103f01 100644 --- a/lisp/startup.el +++ b/lisp/startup.el | |||
| @@ -958,6 +958,38 @@ or `CVS', and any subdirectory that contains a file named `.nosearch'." | |||
| 958 | (or mail-host-address | 958 | (or mail-host-address |
| 959 | (system-name))))) | 959 | (system-name))))) |
| 960 | 960 | ||
| 961 | ;; Originally face attributes were specified via | ||
| 962 | ;; `font-lock-face-attributes'. Users then changed the default | ||
| 963 | ;; face attributes by setting that variable. However, we try and | ||
| 964 | ;; be back-compatible and respect its value if set except for | ||
| 965 | ;; faces where M-x customize has been used to save changes for the | ||
| 966 | ;; face. | ||
| 967 | (when (boundp 'font-lock-face-attributes) | ||
| 968 | (let ((face-attributes font-lock-face-attributes)) | ||
| 969 | (while face-attributes | ||
| 970 | (let* ((face-attribute (pop face-attributes)) | ||
| 971 | (face (car face-attribute))) | ||
| 972 | ;; Rustle up a `defface' SPEC from a | ||
| 973 | ;; `font-lock-face-attributes' entry. | ||
| 974 | (unless (get face 'saved-face) | ||
| 975 | (let ((foreground (nth 1 face-attribute)) | ||
| 976 | (background (nth 2 face-attribute)) | ||
| 977 | (bold-p (nth 3 face-attribute)) | ||
| 978 | (italic-p (nth 4 face-attribute)) | ||
| 979 | (underline-p (nth 5 face-attribute)) | ||
| 980 | face-spec) | ||
| 981 | (when foreground | ||
| 982 | (setq face-spec (cons ':foreground (cons foreground face-spec)))) | ||
| 983 | (when background | ||
| 984 | (setq face-spec (cons ':background (cons background face-spec)))) | ||
| 985 | (when bold-p | ||
| 986 | (setq face-spec (append '(:weight bold) face-spec))) | ||
| 987 | (when italic-p | ||
| 988 | (setq face-spec (append '(:slant italic) face-spec))) | ||
| 989 | (when underline-p | ||
| 990 | (setq face-spec (append '(:underline t) face-spec))) | ||
| 991 | (face-spec-set face (list (list t face-spec)) nil))))))) | ||
| 992 | |||
| 961 | ;; If parameter have been changed in the init file which influence | 993 | ;; If parameter have been changed in the init file which influence |
| 962 | ;; face realization, clear the face cache so that new faces will | 994 | ;; face realization, clear the face cache so that new faces will |
| 963 | ;; be realized. | 995 | ;; be realized. |