From 52436656c356cfb835364aa958193dd47b9336b1 Mon Sep 17 00:00:00 2001 From: Simon Marshall Date: Thu, 1 Jun 1995 09:08:29 +0000 Subject: [PATCH] Made font-lock-compile-keywords not compile if it looks like it already has. --- lisp/font-lock.el | 36 +++++++++++++++++++----------------- 1 file changed, 19 insertions(+), 17 deletions(-) diff --git a/lisp/font-lock.el b/lisp/font-lock.el index 83ca7e049cc..af9fca1d313 100644 --- a/lisp/font-lock.el +++ b/lisp/font-lock.el @@ -497,25 +497,27 @@ the face is also set; its value is the face name." ;;; Fontifying arbitrary patterns -(defun font-lock-compile-keywords () +(defun font-lock-compile-keywords (&optional keywords) ;; Compile `font-lock-keywords' into the form (t KEYWORD ...) where KEYWORD ;; is the (MATCHER HIGHLIGHT ...) shown in the variable's doc string. - (setq font-lock-keywords - (cons t - (mapcar (function - (lambda (item) - (cond ((nlistp item) - (list item '(0 font-lock-keyword-face))) - ((numberp (cdr item)) - (list (car item) (list (cdr item) - 'font-lock-keyword-face))) - ((symbolp (cdr item)) - (list (car item) (list 0 (cdr item)))) - ((nlistp (nth 1 item)) - (list (car item) (cdr item))) - (t - item)))) - font-lock-keywords)))) + (let ((keywords (or keywords font-lock-keywords))) + (setq font-lock-keywords + (if (eq (car-safe keywords) t) + keywords + (cons t + (mapcar + (function (lambda (item) + (cond ((nlistp item) + (list item '(0 font-lock-keyword-face))) + ((numberp (cdr item)) + (list (car item) (list (cdr item) 'font-lock-keyword-face))) + ((symbolp (cdr item)) + (list (car item) (list 0 (cdr item)))) + ((nlistp (nth 1 item)) + (list (car item) (cdr item))) + (t + item)))) + keywords)))))) (defsubst font-lock-apply-highlight (highlight) "Apply HIGHLIGHT following a match. See `font-lock-keywords'." -- 2.39.2