changeset 80112:c0a87fab3914

(font-lock-set-defaults): Unset previously set variables when needed.
author Stefan Monnier <monnier@iro.umontreal.ca>
date Tue, 12 Feb 2008 16:49:21 +0000
parents 5198b2fd41e6
children 5b4e8ae6e892
files lisp/ChangeLog lisp/font-lock.el
diffstat 2 files changed, 16 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/ChangeLog	Tue Feb 12 14:36:34 2008 +0000
+++ b/lisp/ChangeLog	Tue Feb 12 16:49:21 2008 +0000
@@ -1,3 +1,8 @@
+2008-02-12  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+	* font-lock.el (font-lock-set-defaults): Unset previously set variables
+	when needed.
+
 2008-02-12  Juanma Barranquero  <lekktu@gmail.com>
 
 	* uniquify.el (uniquify-buffer-base-name): New function.
--- a/lisp/font-lock.el	Tue Feb 12 14:36:34 2008 +0000
+++ b/lisp/font-lock.el	Tue Feb 12 16:49:21 2008 +0000
@@ -1777,13 +1777,16 @@
 	    (cdr-safe (assq major-mode font-lock-removed-keywords-alist))))
       (set (make-local-variable 'font-lock-defaults) defaults)
       ;; Syntactic fontification?
-      (when (nth 1 defaults)
-	(set (make-local-variable 'font-lock-keywords-only) t))
+      (if (nth 1 defaults)
+          (set (make-local-variable 'font-lock-keywords-only) t)
+        (kill-local-variable 'font-lock-keywords-only))
       ;; Case fold during regexp fontification?
-      (when (nth 2 defaults)
-	(set (make-local-variable 'font-lock-keywords-case-fold-search) t))
+      (if (nth 2 defaults)
+          (set (make-local-variable 'font-lock-keywords-case-fold-search) t)
+        (kill-local-variable 'font-lock-keywords-case-fold-search))
       ;; Syntax table for regexp and syntactic fontification?
-      (when (nth 3 defaults)
+      (if (null (nth 3 defaults))
+          (kill-local-variable 'font-lock-syntax-table)
 	(set (make-local-variable 'font-lock-syntax-table)
 	     (copy-syntax-table (syntax-table)))
 	(dolist (selem (nth 3 defaults))
@@ -1794,9 +1797,10 @@
 			    (mapcar 'identity (car selem))))
 	      (modify-syntax-entry char syntax font-lock-syntax-table)))))
       ;; Syntax function for syntactic fontification?
-      (when (nth 4 defaults)
+      (if (nth 4 defaults)
 	(set (make-local-variable 'font-lock-beginning-of-syntax-function)
-	     (nth 4 defaults)))
+               (nth 4 defaults))
+        (kill-local-variable 'font-lock-beginning-of-syntax-function))
       ;; Variable alist?
       (dolist (x (nthcdr 5 defaults))
 	(set (make-local-variable (car x)) (cdr x)))