Mercurial > emacs
changeset 12268:f22803cfdc5c
Change so font-lock-make-faces doesn't stomp all over user Font Lock faces.
author | Simon Marshall <simon@gnu.org> |
---|---|
date | Fri, 16 Jun 1995 07:47:09 +0000 |
parents | e3421dcda014 |
children | 8c44bbf1cafe |
files | lisp/font-lock.el |
diffstat | 1 files changed, 13 insertions(+), 8 deletions(-) [+] |
line wrap: on
line diff
--- a/lisp/font-lock.el Fri Jun 16 06:19:38 1995 +0000 +++ b/lisp/font-lock.el Fri Jun 16 07:47:09 1995 +0000 @@ -215,12 +215,10 @@ resource `Emacs.font-lock-comment-face.attributeUnderline' can be used to specify the UNDERLINE-P attribute for face `font-lock-comment-face'.") -(defvar font-lock-make-faces-done nil - "Non-nil if have already set up the faces for Font Lock mode.") - -(defun font-lock-make-faces () +(defun font-lock-make-faces (&optional override) "Make faces from `font-lock-face-attributes'. A default list is used if this is nil. +If optional OVERRIDE is non-nil, faces that already exist are reset. See `font-lock-make-face' and `list-faces-display'." ;; We don't need to `setq' any of these variables, but the user can see what ;; is being used if we do. @@ -299,8 +297,16 @@ (font-lock-variable-name-face "LightGoldenrod") (font-lock-type-face "PaleGreen") (font-lock-reference-face "Aquamarine"))))))) - (mapcar 'font-lock-make-face font-lock-face-attributes) - (setq font-lock-make-faces-done t)) + ;; Now make the faces if we have to. + (mapcar (function (lambda (face-attributes) + (let ((face (nth 0 face-attributes))) + (if (and (not override) (facep face)) + ;; The face exists. Only set the variable if it's nil. + (if (or (not (boundp face)) (symbol-value face)) + (set face face)) + ;; The face doesn't exist or we can stomp all over it anyway. + (font-lock-make-face face-attributes))))) + font-lock-face-attributes)) (defun font-lock-make-face (face-attributes) "Make a face from FACE-ATTRIBUTES. @@ -939,8 +945,7 @@ Sets `font-lock-keywords', `font-lock-no-comments', `font-lock-syntax-table' and `font-lock-keywords-case-fold-search' using `font-lock-defaults-alist'." ;; Set face defaults. - (or font-lock-make-faces-done - (font-lock-make-faces)) + (font-lock-make-faces) ;; Set fontification defaults. (or font-lock-keywords (let ((defaults (or font-lock-defaults