# HG changeset patch # User yoshiki # Date 990702114 0 # Node ID e62e90435c57218496fa3173735b2aff668d85e0 # Parent e9162e1ea20023d0de465d12bcd6e2261b8becf1 [xemacs-hg @ 2001-05-24 11:01:53 by yoshiki] Daiki Ueno's patch "side effect on font-lock-keywords", * font-lock.el (font-lock-compile-keywords): Rewrite as a side effect free function. (font-lock-fontify-keywords-region): Supply the argument to font-lock-compile-keywords. diff -r e9162e1ea200 -r e62e90435c57 lisp/ChangeLog --- a/lisp/ChangeLog Thu May 24 09:53:18 2001 +0000 +++ b/lisp/ChangeLog Thu May 24 11:01:54 2001 +0000 @@ -1,3 +1,10 @@ +2001-05-10 Daiki Ueno + + * font-lock.el (font-lock-compile-keywords): Rewrite as a side + effect free function. + (font-lock-fontify-keywords-region): Supply the argument to + font-lock-compile-keywords. + 2001-05-24 Ben Wing * subr.el: diff -r e9162e1ea200 -r e62e90435c57 lisp/font-lock.el --- a/lisp/font-lock.el Thu May 24 09:53:18 2001 +0000 +++ b/lisp/font-lock.el Thu May 24 11:01:54 2001 +0000 @@ -1592,10 +1592,12 @@ START should be at the beginning of a line." (let ((loudly (and font-lock-verbose (>= (- end start) font-lock-message-threshold)))) + ;; If `font-lock-keywords' is not compiled, compile it. + (unless (eq (car-safe font-lock-keywords) t) + (setq font-lock-keywords (font-lock-compile-keywords + font-lock-keywords))) (let* ((case-fold-search font-lock-keywords-case-fold-search) - (keywords (cdr (if (eq (car-safe font-lock-keywords) t) - font-lock-keywords - (font-lock-compile-keywords)))) + (keywords (cdr font-lock-keywords)) (bufname (buffer-name)) (progress 5) (old-progress 5) (iter 0) @@ -1669,14 +1671,12 @@ ;; Various functions. -(defun font-lock-compile-keywords (&optional keywords) +(defun font-lock-compile-keywords (keywords) ;; Compile `font-lock-keywords' into the form (t KEYWORD ...) where KEYWORD ;; is the (MATCHER HIGHLIGHT ...) shown in the variable's doc string. - (let ((keywords (or keywords font-lock-keywords))) - (setq font-lock-keywords - (if (eq (car-safe keywords) t) - keywords - (cons t (mapcar 'font-lock-compile-keyword keywords)))))) + (if (eq (car-safe keywords) t) + keywords + (cons t (mapcar 'font-lock-compile-keyword keywords)))) (defun font-lock-compile-keyword (keyword) (cond ((nlistp keyword) ; Just MATCHER