# HG changeset patch # User Simon Marshall # Date 803288829 0 # Node ID f22803cfdc5c03b0dcc25aa167d879f64e9c4616 # Parent e3421dcda01481a1fdd2dd909f2acad5a912164c Change so font-lock-make-faces doesn't stomp all over user Font Lock faces. diff -r e3421dcda014 -r f22803cfdc5c lisp/font-lock.el --- 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