Mercurial > emacs
changeset 12047:e6001f10daad
Made font-lock-compile-keywords not compile if it looks like it already has.
author | Simon Marshall <simon@gnu.org> |
---|---|
date | Thu, 01 Jun 1995 09:08:29 +0000 |
parents | d23f2c9990b2 |
children | 8e3d4f515bbb |
files | lisp/font-lock.el |
diffstat | 1 files changed, 19 insertions(+), 17 deletions(-) [+] |
line wrap: on
line diff
--- a/lisp/font-lock.el Wed May 31 21:18:55 1995 +0000 +++ b/lisp/font-lock.el Thu Jun 01 09:08:29 1995 +0000 @@ -497,25 +497,27 @@ ;;; 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'."