changeset 75999:ce1b9c8dc108

(font-lock-extend-region-wholelines): Revert last change.
author Stefan Monnier <monnier@iro.umontreal.ca>
date Sun, 18 Feb 2007 18:52:18 +0000
parents d1cf25818d0c
children 8d61685ee62b
files lisp/ChangeLog lisp/font-lock.el
diffstat 2 files changed, 28 insertions(+), 17 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/ChangeLog	Sun Feb 18 14:38:36 2007 +0000
+++ b/lisp/ChangeLog	Sun Feb 18 18:52:18 2007 +0000
@@ -29,11 +29,6 @@
 	* emacs-lisp/lisp-mode.el (calculate-lisp-indent): Added
 	indentation for the constants of Lisp.
 
-2007-02-17  David Hansen  <david.hansen@physik.fu-berlin.de>  (tiny change)
-
-	* font-lock.el (font-lock-extend-region-wholelines): Test for EOB
-	in addition to BOL.
-
 2007-02-16  Stefan Monnier  <monnier@iro.umontreal.ca>
 
 	* ps-print.el: Use (defvar <foo>) where applicable.
--- a/lisp/font-lock.el	Sun Feb 18 14:38:36 2007 +0000
+++ b/lisp/font-lock.el	Sun Feb 18 18:52:18 2007 +0000
@@ -350,7 +350,7 @@
  (MATCHER . SUBEXP)
  (MATCHER . FACENAME)
  (MATCHER . HIGHLIGHT)
- (MATCHER HIGHLIGHT ...)
+ (MATCHER . HIGHLIGHTS)
  (eval . FORM)
 
 where MATCHER can be either the regexp to search for, or the function name to
@@ -1040,6 +1040,13 @@
 Useful for things like RMAIL and Info where the whole buffer is not
 a very meaningful entity to highlight.")
 
+(defvar font-lock-syntax-props-depend-on-themselves nil
+  "If non-nil, syntax-table changes may influence syntactic keywords.
+If the syntax-table properties set by syntactic-keywords themselves depend
+on syntax-table properties set on the text before it by syntactic-keywords,
+this variable should be set to non-nil, so that whenever syntaxtic-keywords
+is applied, the subsequent text is marked for syntactic re-fontification.")
+
 
 (defvar font-lock-beg) (defvar font-lock-end)
 (defvar font-lock-extend-region-functions
@@ -1087,7 +1094,7 @@
   "Move fontification boundaries to beginning of lines."
   (let ((changed nil))
     (goto-char font-lock-beg)
-    (unless (or (bolp) (eobp))
+    (unless (bolp)
       (setq changed t font-lock-beg (line-beginning-position)))
     (goto-char font-lock-end)
     (unless (bolp)
@@ -1124,11 +1131,25 @@
             (setq beg font-lock-beg end font-lock-end))
 	  ;; Now do the fontification.
 	  (font-lock-unfontify-region beg end)
-	  (when font-lock-syntactic-keywords
-	    (font-lock-fontify-syntactic-keywords-region beg end))
-	  (unless font-lock-keywords-only
-	    (font-lock-fontify-syntactically-region beg end loudly))
-	  (font-lock-fontify-keywords-region beg end loudly))
+          (let ((sbeg beg))
+            (cond
+             ((< font-lock-syntactically-fontified sbeg)
+              ;; Ensure the syntax-table prop is properly set on the text
+              ;; before beg.
+              (setq sbeg (max font-lock-syntactically-fontified (point-min)))
+              (setq font-lock-syntactically-fontified end))
+             ((and font-lock-syntax-props-depend-on-themselves
+                   (> font-lock-syntactically-fontified end))
+              ;; If the syntax-table properties set by
+              ;; font-lock-syntactic-keywords themselves depend on
+              ;; syntax-table props set in the text above it, then we'll
+              ;; need to update all the syntax-table props below end.
+              (setq font-lock-syntactically-fontified end)))
+            (when font-lock-syntactic-keywords
+              (font-lock-fontify-syntactic-keywords-region sbeg end)))
+          (unless font-lock-keywords-only
+            (font-lock-fontify-syntactically-region beg end loudly))
+          (font-lock-fontify-keywords-region beg end loudly))
       ;; Clean up.
       (set-syntax-table old-syntax-table))))
 
@@ -1418,11 +1439,6 @@
 (defun font-lock-fontify-syntactic-keywords-region (start end)
   "Fontify according to `font-lock-syntactic-keywords' between START and END.
 START should be at the beginning of a line."
-  ;; Ensure the beginning of the file is properly syntactic-fontified.
-  (when (and font-lock-syntactically-fontified
-	     (< font-lock-syntactically-fontified start))
-    (setq start (max font-lock-syntactically-fontified (point-min)))
-    (setq font-lock-syntactically-fontified end))
   ;; If `font-lock-syntactic-keywords' is a symbol, get the real keywords.
   (when (symbolp font-lock-syntactic-keywords)
     (setq font-lock-syntactic-keywords (font-lock-eval-keywords