(exec-suffixes): Initialize to a system-dependent value.
[bpt/emacs.git] / lisp / jit-lock.el
index 04fd778..cf97a44 100644 (file)
@@ -1,4 +1,4 @@
-;;; jit-lock.el --- just-in-time fontification.
+;;; jit-lock.el --- just-in-time fontification
 
 ;; Copyright (C) 1998, 2000, 2001 Free Software Foundation, Inc.
 
@@ -264,8 +264,15 @@ Defaults to the whole buffer.  END can be out of bounds."
        (widen)
        (unless start (setq start (point-min)))
        (setq end (if end (min end (point-max)) (point-max)))
-       (let ((font-lock-beginning-of-syntax-function nil)
-            next)
+       ;; This did bind `font-lock-beginning-of-syntax-function' to
+       ;; nil at some point, for an unknown reason.  Don't do this; it
+       ;; can make highlighting slow due to expensive calls to
+       ;; `parse-partial-sexp' in function
+       ;; `font-lock-fontify-syntactically-region'.  Example: paging
+       ;; from the end of a buffer to its start, can do repeated
+       ;; `parse-partial-sexp' starting from `point-min', which can
+       ;; take a long time in a large buffer.
+       (let (next)
         (save-match-data
           ;; Fontify chunks beginning at START.  The end of a
           ;; chunk is either `end', or the start of a region
@@ -419,14 +426,6 @@ will take place when text is fontified stealthily."
   (when jit-lock-mode
     (save-excursion
       (with-buffer-prepared-for-jit-lock
-       ;; If we're in text that matches a multi-line font-lock pattern,
-       ;; make sure the whole text will be redisplayed.
-       (when (and font-lock-multiline
-                 (get-text-property start 'font-lock-multiline))
-        (setq start (or (previous-single-property-change
-                         start 'font-lock-multiline)
-                        (point-min))))
-       
        ;; It's important that the `fontified' property be set from the
        ;; beginning of the line, else font-lock will properly change the
        ;; text's face, but the display will have been done already and will
@@ -434,6 +433,13 @@ will take place when text is fontified stealthily."
        (goto-char start)
        (setq start (line-beginning-position))
        
+       ;; If we're in text that matches a multi-line font-lock pattern,
+       ;; make sure the whole text will be redisplayed.
+       (when (get-text-property start 'font-lock-multiline)
+        (setq start (or (previous-single-property-change
+                         start 'font-lock-multiline)
+                        (point-min))))
+       
        ;; Make sure we change at least one char (in case of deletions).
        (setq end (min (max end (1+ start)) (point-max)))
        ;; Request refontification.
@@ -445,4 +451,4 @@ will take place when text is fontified stealthily."
   
 (provide 'jit-lock)
 
-;; jit-lock.el ends here
+;;; jit-lock.el ends here