aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimon Marshall1995-06-16 07:47:09 +0000
committerSimon Marshall1995-06-16 07:47:09 +0000
commit8862b0db81b6b8d565198237f43e7aea7088f19f (patch)
treea03be5aa84eea830cbf918cc296ad9128633a2a5
parent7079aefa34613e31ed4cee5cb7213adbdf0bb901 (diff)
downloademacs-8862b0db81b6b8d565198237f43e7aea7088f19f.tar.gz
emacs-8862b0db81b6b8d565198237f43e7aea7088f19f.zip
Change so font-lock-make-faces doesn't stomp all over user Font Lock faces.
-rw-r--r--lisp/font-lock.el21
1 files changed, 13 insertions, 8 deletions
diff --git a/lisp/font-lock.el b/lisp/font-lock.el
index af9fca1d313..aea2bc2cb9b 100644
--- a/lisp/font-lock.el
+++ b/lisp/font-lock.el
@@ -215,12 +215,10 @@ Resources can be used to over-ride these face attributes. For example, the
215resource `Emacs.font-lock-comment-face.attributeUnderline' can be used to 215resource `Emacs.font-lock-comment-face.attributeUnderline' can be used to
216specify the UNDERLINE-P attribute for face `font-lock-comment-face'.") 216specify the UNDERLINE-P attribute for face `font-lock-comment-face'.")
217 217
218(defvar font-lock-make-faces-done nil 218(defun font-lock-make-faces (&optional override)
219 "Non-nil if have already set up the faces for Font Lock mode.")
220
221(defun font-lock-make-faces ()
222 "Make faces from `font-lock-face-attributes'. 219 "Make faces from `font-lock-face-attributes'.
223A default list is used if this is nil. 220A default list is used if this is nil.
221If optional OVERRIDE is non-nil, faces that already exist are reset.
224See `font-lock-make-face' and `list-faces-display'." 222See `font-lock-make-face' and `list-faces-display'."
225 ;; We don't need to `setq' any of these variables, but the user can see what 223 ;; We don't need to `setq' any of these variables, but the user can see what
226 ;; is being used if we do. 224 ;; is being used if we do.
@@ -299,8 +297,16 @@ See `font-lock-make-face' and `list-faces-display'."
299 (font-lock-variable-name-face "LightGoldenrod") 297 (font-lock-variable-name-face "LightGoldenrod")
300 (font-lock-type-face "PaleGreen") 298 (font-lock-type-face "PaleGreen")
301 (font-lock-reference-face "Aquamarine"))))))) 299 (font-lock-reference-face "Aquamarine")))))))
302 (mapcar 'font-lock-make-face font-lock-face-attributes) 300 ;; Now make the faces if we have to.
303 (setq font-lock-make-faces-done t)) 301 (mapcar (function (lambda (face-attributes)
302 (let ((face (nth 0 face-attributes)))
303 (if (and (not override) (facep face))
304 ;; The face exists. Only set the variable if it's nil.
305 (if (or (not (boundp face)) (symbol-value face))
306 (set face face))
307 ;; The face doesn't exist or we can stomp all over it anyway.
308 (font-lock-make-face face-attributes)))))
309 font-lock-face-attributes))
304 310
305(defun font-lock-make-face (face-attributes) 311(defun font-lock-make-face (face-attributes)
306 "Make a face from FACE-ATTRIBUTES. 312 "Make a face from FACE-ATTRIBUTES.
@@ -939,8 +945,7 @@ This does a lot more highlighting.")
939Sets `font-lock-keywords', `font-lock-no-comments', `font-lock-syntax-table' 945Sets `font-lock-keywords', `font-lock-no-comments', `font-lock-syntax-table'
940and `font-lock-keywords-case-fold-search' using `font-lock-defaults-alist'." 946and `font-lock-keywords-case-fold-search' using `font-lock-defaults-alist'."
941 ;; Set face defaults. 947 ;; Set face defaults.
942 (or font-lock-make-faces-done 948 (font-lock-make-faces)
943 (font-lock-make-faces))
944 ;; Set fontification defaults. 949 ;; Set fontification defaults.
945 (or font-lock-keywords 950 (or font-lock-keywords
946 (let ((defaults (or font-lock-defaults 951 (let ((defaults (or font-lock-defaults