changeset 566:e62e90435c57

[xemacs-hg @ 2001-05-24 11:01:53 by yoshiki] Daiki Ueno's patch "side effect on font-lock-keywords", <m2n18lsumy.fsf@deisui.bug.org> * 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.
author yoshiki
date Thu, 24 May 2001 11:01:54 +0000
parents e9162e1ea200
children 4a2749e56f92
files lisp/ChangeLog lisp/font-lock.el
diffstat 2 files changed, 16 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- 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  <ueno@unixuser.org>
+
+	* 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  <ben@xemacs.org>
 
 	* subr.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