# HG changeset patch # User Stefan Monnier # Date 1033491282 0 # Node ID 2cf6194833de415f237a5f248e16f46df0334fe3 # Parent a9daf35fd318dd5bd0e9b14bcacf401ec0d1f205 (jit-lock-fontify-now): Don't widen. Let the jit-lock-functions do it if they want to. diff -r a9daf35fd318 -r 2cf6194833de lisp/jit-lock.el --- a/lisp/jit-lock.el Tue Oct 01 16:29:40 2002 +0000 +++ b/lisp/jit-lock.el Tue Oct 01 16:54:42 2002 +0000 @@ -297,45 +297,43 @@ Defaults to the whole buffer. END can be out of bounds." (with-buffer-prepared-for-jit-lock (save-excursion - (save-restriction - (widen) - (unless start (setq start (point-min))) - (setq end (if end (min end (point-max)) (point-max))) - ;; 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 - ;; before `end' that has already been fontified. - (while start - ;; Determine the end of this chunk. - (setq next (or (text-property-any start end 'fontified t) - end)) + (unless start (setq start (point-min))) + (setq end (if end (min end (point-max)) (point-max))) + ;; 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 + ;; before `end' that has already been fontified. + (while start + ;; Determine the end of this chunk. + (setq next (or (text-property-any start end 'fontified t) + end)) - ;; Decide which range of text should be fontified. - ;; The problem is that START and NEXT may be in the - ;; middle of something matched by a font-lock regexp. - ;; Until someone has a better idea, let's start - ;; at the start of the line containing START and - ;; stop at the start of the line following NEXT. - (goto-char next) (setq next (line-beginning-position 2)) - (goto-char start) (setq start (line-beginning-position)) + ;; Decide which range of text should be fontified. + ;; The problem is that START and NEXT may be in the + ;; middle of something matched by a font-lock regexp. + ;; Until someone has a better idea, let's start + ;; at the start of the line containing START and + ;; stop at the start of the line following NEXT. + (goto-char next) (setq next (line-beginning-position 2)) + (goto-char start) (setq start (line-beginning-position)) - ;; Fontify the chunk, and mark it as fontified. - ;; We mark it first, to make sure that we don't indefinitely - ;; re-execute this fontification if an error occurs. - (put-text-property start next 'fontified t) - (run-hook-with-args 'jit-lock-functions start next) + ;; Fontify the chunk, and mark it as fontified. + ;; We mark it first, to make sure that we don't indefinitely + ;; re-execute this fontification if an error occurs. + (put-text-property start next 'fontified t) + (run-hook-with-args 'jit-lock-functions start next) - ;; Find the start of the next chunk, if any. - (setq start (text-property-any next end 'fontified nil))))))))) + ;; Find the start of the next chunk, if any. + (setq start (text-property-any next end 'fontified nil)))))))) ;;; Stealth fontification.